Fotiman

msg:4539253 | 2:11 pm on Jan 25, 2013 (gmt 0) |
You're attaching an event listener to the window's scroll event. When the page first loads, that event won't be fired, so you need to also repeat that functionality in the ready method. jQuery(document).ready(function () {
if (jQuery(window).scrollTop() != 0) { jQuery('.mybutton1').fadeIn(); } else { jQuery('.mybutton1').fadeOut(); }
jQuery(window).scroll(function () { if (jQuery(this).scrollTop() != 0) { jQuery('.mybutton1').fadeIn(); } else { jQuery('.mybutton1').fadeOut(); } });
jQuery('.mybutton1').click(function () { jQuery("html, body").animate({ scrollTop: 0 }, 850); return false; });
});
|
|
|
toplisek

msg:4540117 | 8:12 am on Jan 29, 2013 (gmt 0) |
It works perfect. 1. What will influence != 0 or > 100 2. Is it correct placement of this javascript as Jquery plugin file/folder or it can be pure javascript file even this is jQuery?
|
toplisek

msg:4540510 | 8:50 am on Jan 30, 2013 (gmt 0) |
3. How to show button or footer when there is scrolled to the the end (bottom)? Is there any setting to do it in the correct way with Jquery modification?
|
Fotiman

msg:4540581 | 2:10 pm on Jan 30, 2013 (gmt 0) |
1. [api.jquery.com...] The vertical scroll position is the same as the number of pixels that are hidden from view above the scrollable area. If the scroll bar is at the very top, or if the element is not scrollable, this number will be 0 |
| 2. This script does not need to be a jQuery "plugin", but does require jQuery, so as long as you include jQuery first, you can put this in a regular script file. 3. That could be tricky. What if someone doesn't need to scroll at all (ie - they have massive monitor/resolution that can fit everything without scrolling)? Why not just put the button/footer at the bottom? That way, when the user gets there, they will have already seen and/or scrolled down through the content.
|
toplisek

msg:4540698 | 7:57 pm on Jan 30, 2013 (gmt 0) |
You are right. Usability issue can be seen if this happens. I gues they detect also resolution to pass this particular issue. I'm nor sure about your URL: [api.jquery.com...] It is not quoted my value: What will influence != 0 or > 100 It is the current vertical position of the scroll bar for each of the set of matched elements.More than 100px position from the top.Yes? What is than !=0 ?
|
Fotiman

msg:4540709 | 8:32 pm on Jan 30, 2013 (gmt 0) |
If scrollTop == 0, the scroll bar is at the very top, or the element is not scrollable. If the element is scrollable, and it is scrolled down more the 100px, then that would match the case of scrollTop() > 100.
|
toplisek

msg:4541470 | 3:55 pm on Feb 1, 2013 (gmt 0) |
What is than != 0 as definition?
|
Fotiman

msg:4541492 | 5:02 pm on Feb 1, 2013 (gmt 0) |
not equal to zero.
|
toplisek

msg:4541802 | 7:26 pm on Feb 2, 2013 (gmt 0) |
Thanks for your reply.
|
|