Jared
Jared

Reputation: 1793

ScrollTo (jquery) doesn't seem to work in FF?

Check the following link in Chrome: http://www.bavarianblue.com/parts-list/?tags=struts

The site is totally jacked in IE - need to fix a bunch of CSS.

I use the follow Javascript to perform the animation (uses jquery.scrollTo-1.4.2-min.js);

jQuery(document).ready(function($) { //required for $ to work in Wordpress
    var moo = $(".tags").attr("rel");
    if (moo == ""){
        return;
    }else {
        var scrolling = $("."+moo).offset().top-100;
        $.scrollTo(scrolling, 800, {easing:'swing'} );
        $('.'+moo).animate({backgroundColor : "#4c4c4c", color : "white"}, function() {
            $(this).animate({backgroundColor : "#dcdcdc"}, function() {
                $(this).animate({backgroundColor : "#4c4c4c"}); //animation wasn't completing chain, thus all the nested functions.                                                        });
        $('.'+moo+' a').animate({color : "#ed9925"});
        }); 
    }
});

Any clue why it doesn't work? Not getting any errors in FF...

EDIT

As @Chouchenos pointed out, a script type wasn't declared, and I didn't close the tag. However, now FF doesn't generate an error, but the animation (changing the BG and the scroll) doesn't work.

Upvotes: 1

Views: 2273

Answers (4)

Shikiryu
Shikiryu

Reputation: 10219

Both FF and IE tell me that

$.scrollTo is not a function

But surprisingly, it works on chrome.

EDIT : Firefox makes an error here I think :

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.js"/>
<script src="http://www.bavarianblue.com/wp-content/themes/Polished/js/jquery.scrollTo-1.4.2-min.js"></script>

It may be like this :

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.js"></script>
<script src="http://www.bavarianblue.com/wp-content/themes/Polished/js/jquery.scrollTo-1.4.2-min.js"></script>

That's why scrollTO doesn't load I think

Upvotes: 1

Elf Sternberg
Elf Sternberg

Reputation: 16361

ScrollTo isn't a native jQuery method; you need Flesler's ScrollTo plug-in.

Upvotes: 0

Daniel Dyson
Daniel Dyson

Reputation: 13230

It seems that the animate and setting the backgroundcolor doesn't work either. Have you tried debugging using Firebug? I suspect that the line if (moo == "") might be returning something unexpected in FF.

I suppose that the problem is that you have display:none on the div with the class="tags". FF possibly won't allow you to scroll to an element that is not displayed on the page while Chrome does.

You can test this by temporarily removing the display:none style from the div and seeing whether it works in FF

Upvotes: 0

Stewie
Stewie

Reputation: 3121

moo =='' : return; and its returning, am I missing something ? Can you give steps to reproduce as what is NOT working ? There is no .tags anywhere .. the tags div contain js

Upvotes: 0

Related Questions