mercredi 3 juin 2015

Issues with randomBackground on iphone/ipad

Im using the following plugin to create random background images on my site -http://ift.tt/1Jlv5qy.

Looks like their demo doesnt work either. Anything I can change in my code to make this work or any idea of better ways to approach?

It is working as should - meaning it scales horizontally to full height - on; Safari 7.1.6 Firefox 37.0.1 Chrome 43.0.2357.81 Chrome (on Android)

And is not working on Chrome (on iPhone/iPad) Safari (on iPhone/iPad)

Any ideas why it wouldn't be working on these Apple devices?

JS

(function($) {

    $.fn.RandBG = function(options) {

        var settings = $.extend({
            ClassPrefix: "bg",
            count: 10
        }, options);

        var index = Math.ceil(Math.random() * settings.count * settings.count) % settings.count;

        $(this).addClass(settings.ClassPrefix + index);
    };

}(jQuery));

CSS

.randbg {
background: url('../img/storage.jpg') no-repeat center center fixed;

-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size:cover;
}
.randbg.bg1 {
background-image: url('../img/rio2.jpg');
}
.randbg.bg2 {
background-image: url('../img/storage.jpg');
}

HTML

    <script>
$(".randbg").RandBG({
ClassPrefix: "bg",
count: 10
});
    </script>

See link here; http://ift.tt/1AO8q36




Aucun commentaire:

Enregistrer un commentaire