• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2793
  • Last Modified:

jquery scrollTop() not working in firefox

I just realized a scroll feature I'm using is causing my site to work differently in firefox.

I've tried a few steps to debug, but can't seem to find the fix based on research from other online articles.  I am not a JS developer so just know enough to be dangerous.

Here is my site: www.axessnetwork.com

Here is the code we're using for the left scrolling nav area:

<script>
    $(document).ready(function() {
        var $scrollingDiv = $("#scrollingDiv");
	
        $(window).scroll(function(){  
			         
            $scrollingDiv
                .stop();
                .animate({"marginTop": ($(window).scrollTop() )}, "slow" );         
        });
    });
</script>

Open in new window

0
axessJosh
Asked:
axessJosh
  • 3
  • 2
  • 2
  • +2
1 Solution
 
leakim971PluritechnicianCommented:
at the end of line 8, I see a semicolumn so your line 9 is used by the hyperspace
0
 
axessJoshAuthor Commented:
I removed that semi-colon, but it has not changed the issue.
0
 
Scott Fell, EE MVEDeveloperCommented:
Go through some of the validation errors

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.axessnetwork.com%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

You don't have to worry about, "An img element must have an alt attribute" for now. However, "Stray end tag div" or "Unclosed element div." might be important.  I find many times fixing this part of the problem.

Nice site and concept!
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Anthony PangilinanDeveloperCommented:
Opening the page in chrome(I know the issue is in firefox, but it's worth looking at this error) gives me this at the '.animate()' call.

Uncaught SyntaxError: Unexpected token .

Maybe you can try:

$(document).ready(function() {
        var $scrollingDiv = $("#scrollingDiv");
	
        $(window).scroll(function(){  
			         
            $scrollingDiv.stop();
            $scrollingDiv.animate({"marginTop": ($(window).scrollTop() )}, "slow" );         
        });
    });

Open in new window


or

$(document).ready(function() {
        var $scrollingDiv = $("body,html");
	
        $(window).scroll(function(){  
			         
            $scrollingDiv.stop();
            $scrollingDiv.animate({"marginTop": ($(window).scrollTop() )}, "slow" );         
        });
    });

Open in new window

0
 
axessJoshAuthor Commented:
I've tried the suggestions but still unable to find what's causing it to work incorrectly.
0
 
Anthony PangilinanDeveloperCommented:
I'm getting this error:
ReferenceError: $ is not defined
$(document).ready(function() {
Try including your jQuery library before the function call.
0
 
GaryCommented:
I've requested that this question be deleted for the following reason:

The question has either no comments or not enough useful information to be called an "answer".
0
 
Anthony PangilinanDeveloperCommented:
The asker never responded to my last suggestion that may have fixed the problem.
0
 
Scott Fell, EE MVEDeveloperCommented:
Anthony Pangilinan, it is not easy to see, but check out Gary's comment:

I have recommended this question be closed as follows:
Accept: Anthony Pangilinan(http:#40087030)
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now