简体   繁体   English

如何为野生动物园浏览器禁用stellar.js?

[英]How do I disable stellar.js for safari browsers?

I am using stellar.js for this website - www.jaisalmera.com - how do I disable the parallax for safari and internet explorer browsers? 我正在此网站上使用stellar.js-www.jaisalmera.com-如何禁用野生动物园和Internet Explorer浏览器的视差? 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? 有人可以让我知道如何针对Safari / IE浏览器执行此操作吗? From research I have seen that the parallax scrolling doesn't work for these. 从研究中,我发现视差滚动不适用于这些。

Thank you! 谢谢!

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();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM