简体   繁体   English

IE7和IE8中的Javascript

[英]Javascript in IE7 and IE8

I have two sliders on my homepage, one is using a plugin (AnythingSlider), and the other is just using jQuery UI (jquery-ui-1.8.9.custom.min.js). 我的主页上有两个滑块,一个使用插件(AnythingSlider),另一个使用jQuery UI(jquery-ui-1.8.9.custom.min.js)。 After I added the AnythingSlider to the page, the hover function on the second slider stopped working in IE7 and IE8. 将AnythingSlider添加到页面后,第二个滑块上的悬停功能在IE7和IE8中停止工作。 This is the code for the hover function: 这是悬停功能的代码:

        st = null;
        $('.homepage-leftscroller').hover(function() {
           slideleft();
           st = setInterval(slideleft, 200);
        }, function() {
           clearInterval(st);
        });

And here is the code for the slideleft function: 这是slideleft函数的代码:

        function slideleft() {
            v = s.slider('option', 'value');
            if (v > 0)
                v -= 50;
            ui.value = v;
            s.slider('option', 'value', v);
            f = s.slider('option', 'slide');
            f(null,ui);
        }

I didn't create the second slider, I did add the first slider. 我没有创建第二个滑块,而是添加了第一个滑块。 The page in question is here: 有问题的页面在这里:

http://rareculture.net/index.php http://rareculture.net/index.php

I appreciate any help that can be offered with this. 感谢您可以为此提供的任何帮助。 Thank you. 谢谢。

PS The code block containing the hover function begins like this: PS包含悬停功能的代码块如下所示开始:

    $(function() {
        slider = $('.artist-homepage-slider .artist-wrapper');

while the AnythingSlider code block begins like this: 而AnythingSlider代码块是这样开始的:

    $(function(){
        $('#slider')

Could that be the issue? 这可能是问题吗? Why would it only break in IE7 and IE8? 为什么只能在IE7和IE8中中断?

I can't tell if this is related to your problem, but the following statements are assigning values to global (or at least, from a wider scope), rather than local , variables. 我无法确定这是否与您的问题有关,但以下语句将值分配给全局变量(或至少从更广泛的范围),而不是局部变量。 If you add var in front of these they'll become declarations and they'll be declared locally . 如果在这些变量前面添加var ,它们将成为声明,并且将在本地声明。

st = null;

v = s.slider('option', 'value');

f = s.slider('option', 'slide');

jslint can detect issues like these. jslint可以检测到此类问题。

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

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