Last change
on this file since 16250 was
11463,
checked in by Henrik Bettermann, 11 years ago
|
Back-to links replaced by animated jQuery plugins.
|
File size:
1.1 KB
|
Line | |
---|
1 | (function($){ |
---|
2 | $.fn.BottomTop = function(pos,cssClass,anchor) { |
---|
3 | |
---|
4 | var easingType = 'easeInOutCubic'; |
---|
5 | var min = -1; |
---|
6 | var inDelay = 500; |
---|
7 | var outDelay = 500; |
---|
8 | var scrollSpeed = 750; |
---|
9 | var containerIDhash = '#' + pos; |
---|
10 | |
---|
11 | // Auto Link |
---|
12 | $('body').append('<a href="#'+anchor+'" id="'+pos+'" class="'+cssClass+'" />'); |
---|
13 | if (anchor == 'bottom') { |
---|
14 | $(containerIDhash).hide().click(function(){ |
---|
15 | $('html, body').animate({scrollTop:$(bottom).offset().top}, scrollSpeed, easingType); |
---|
16 | return false; |
---|
17 | }) |
---|
18 | } |
---|
19 | if (anchor == '') { |
---|
20 | $(containerIDhash).hide().click(function(){ |
---|
21 | $('html, body').animate({scrollTop:0}, scrollSpeed, easingType); |
---|
22 | return false; |
---|
23 | }) |
---|
24 | } |
---|
25 | |
---|
26 | $(window).scroll(function() { |
---|
27 | var sd = $(window).scrollTop(); |
---|
28 | |
---|
29 | if ( sd > min ) |
---|
30 | $(containerIDhash).fadeIn(inDelay); |
---|
31 | else |
---|
32 | $(containerIDhash).fadeOut(Outdelay); |
---|
33 | }); |
---|
34 | |
---|
35 | }; |
---|
36 | })(jQuery); |
---|
37 | |
---|
38 | |
---|
39 | $(document).ready(function(){ |
---|
40 | $('.top').BottomTop('toTop-right','scroll-up',''); |
---|
41 | }); |
---|
42 | |
---|
43 | $(document).ready(function(){ |
---|
44 | $('.bottom').BottomTop('toBottom-right','scroll-down','bottom'); |
---|
45 | }); |
---|
Note: See
TracBrowser for help on using the repository browser.