Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-11-2013, 11:30 PM   PM User | #1
ManuelVRC
New Coder

 
Join Date: Sep 2011
Location: Seveso, Italy
Posts: 15
Thanks: 1
Thanked 0 Times in 0 Posts
ManuelVRC is an unknown quantity at this point
Question scrollTop malfunction

Hi everyone...

I'm developing a website for my customer and I've implemented jQuery with a simple script:
Code:
var fixed = false;

$(window).scroll(function() {
	 if( $(window).scrollTop() + $(window).height() == $(document).height()) {
        if( !fixed ) {
            fixed = true;
            $('.return').fadeIn("slow");
        }                                           
    } else {
        if( fixed ) {
            fixed = false;
            $('.return').fadeOut("slow");
        }
    }
});
Where is the problem?
Well in the homepage all is ok no errors, when I scroll until the end of the page, the div with the link for return to top appears and when I scoll to top the div disappear.
In the second page I've implemented the same structure of the page, I've added only different text and a custom Google Maps with her API. What happens now? The script work on the contrary, when I scroll until the end of the page the div disappears and when I scroll to top this b***h appears.

What is the mistake?

Last edited by ManuelVRC; 01-12-2013 at 10:41 PM..
ManuelVRC is offline   Reply With Quote
Reply

Bookmarks

Tags
jquery

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:35 PM.


Advertisement
Log in to turn off these ads.