开发者

jScrollTo bugging out in IE7 + 8, works fine in FF and IE9

I'm using the jScrollTo plugin to create this webs开发者_开发问答ite [removed]

Sadly, I've spent a few hours trying to debug why it's not working in IE7/8, I've tried many things but can't figure it out.

Here's a demo of it when it works in IE7/8: http://www.queness.com/resources/html/scroll/horizontal.html

Help! :( Sorry if my post isn't formatted correctly, I'm new to StackOverflow.

Solution Below

The jQuery

$(document).ready(function() {

$('a.panel').click(function () {

    $('a.panel').removeClass('selected');
    $(this).addClass('selected');

    current = $(this);
        //$('#wrapper').scrollTo('#item1', { margin: true});
    $('#wrapper').scrollTo($(this).attr('href'), 800);      
    //
    return false;
});

$(window).resize(function () {
    resizePanel();
});

});

The error round abouts:

SCRIPT438: Object doesn't support this property or method 

$(document).ready(function() {

$('a.panel').click(function () {

    $('a.panel').removeClass('selected');
    $(this).addClass('selected');
    **current = $(this);**
    $('#wrapper').scrollTo($(this).attr('href'), 1000);     
    //
    return false;
});

$(window).resize(function () {
    resizePanel();
});

});

THE SOLUTION

    $(document).ready(function() {

$('a.panel').click(function () {

    $('a.panel').removeClass('selected');
    $(this).addClass('selected');
            *current = $(this); // remove this*
    **var selected = $(this); //add this new line**
    $('#wrapper').scrollTo($(this).attr('href'), 1000);     
    //
    return false;
});


Move your first <script> tag below the includes of dependent scripts such as jQuery and scrollTo.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜