• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3039
  • 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 MVEDeveloper & EE ModeratorCommented:
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 MVEDeveloper & EE ModeratorCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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