2

I am using stellar.js for this website - www.jaisalmera.com - how do I disable the parallax for safari and internet explorer browsers? I have already disabled it for mobile devices with this -

if ($(window).width() > 800) {
    $(window).stellar();
    }

Can someone let me know how to do this for Safari / IE browsers also? From research I have seen that the parallax scrolling doesn't work for these.

Thank you!

1 Answers1

0

I am pretty late in the party but hoping to get some cake and also to help someone out having the same requirement-

You can use the below script to detect the browser type by its feature detection as specified in this post.

    var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
    // Opera 8.0+ (UA detection to detect Blink/v8-powered Opera)
    var isFirefox = typeof InstallTrigger !== 'undefined';   // Firefox 1.0+
    var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
    // At least Safari 3+: "[object HTMLElementConstructor]"
    var isChrome = !!window.chrome && !isOpera;              // Chrome 1+
    var isIE = /*@cc_on!@*/false || !!document.documentMode; // At least IE6

After that you can turn off the stellar initialization for specific browsers like-

if(!isSafari || !isIE)
{
    $(window).stellar();
}
Community
  • 1
  • 1
Manik Arora
  • 4,702
  • 1
  • 25
  • 48