?
Solved

jquery scrollTop() not working in firefox

Posted on 2014-04-23
11
Medium Priority
?
2,730 Views
Last Modified: 2014-05-28
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
Comment
Question by:axessJosh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
11 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 40019004
at the end of line 8, I see a semicolumn so your line 9 is used by the hyperspace
0
 
LVL 2

Author Comment

by:axessJosh
ID: 40019081
I removed that semi-colon, but it has not changed the issue.
0
 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 40019704
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Expert Comment

by:Anthony Pangilinan
ID: 40023909
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
 
LVL 2

Author Comment

by:axessJosh
ID: 40027893
I've tried the suggestions but still unable to find what's causing it to work incorrectly.
0
 
LVL 3

Accepted Solution

by:
Anthony Pangilinan earned 1600 total points
ID: 40035027
I'm getting this error:
ReferenceError: $ is not defined
$(document).ready(function() {
Try including your jQuery library before the function call.
0
 
LVL 58

Expert Comment

by:Gary
ID: 40087029
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
 
LVL 3

Expert Comment

by:Anthony Pangilinan
ID: 40087030
The asker never responded to my last suggestion that may have fixed the problem.
0
 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 40087814
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question