Advertisement
Guest User

BTP SCRIPT2

a guest
Jun 26th, 2011
7,154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. <script type="text/javascript" src="http://davidwalsh.name/dw-content/jquery-1.3.2.js"></script>
  2. <script type="text/javascript" src="http://davidwalsh.name/dw-content/jquery.scrollTo-1.4.0-min.js"></script>
  3. <script type="text/javascript">
  4. jQuery.fn.topLink = function(settings) {
  5. settings = jQuery.extend({
  6. min: 1,
  7. fadeSpeed: 200,
  8. ieOffset: 50
  9. }, settings);
  10. return this.each(function() {
  11. //listen for scroll
  12. var el = $(this);
  13. el.css('display','none'); //in case the user forgot
  14. $(window).scroll(function() {
  15. if(!jQuery.support.hrefNormalized) {
  16. el.css({
  17. 'position': 'absolute',
  18. 'top': $(window).scrollTop() + $(window).height() - settings.ieOffset
  19. });
  20. }
  21. if($(window).scrollTop() >= settings.min)
  22. {
  23. el.fadeIn(settings.fadeSpeed);
  24. }
  25. else
  26. {
  27. el.fadeOut(settings.fadeSpeed);
  28. }
  29. });
  30. });
  31. };
  32.  
  33. $(document).ready(function() {
  34. $('#top-link').topLink({
  35. min: 400,
  36. fadeSpeed: 500
  37. });
  38. //smoothscroll
  39. $('#top-link').click(function(e) {
  40. e.preventDefault();
  41. $.scrollTo(0,300);
  42. });
  43. });
  44.  
  45.  
  46. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement