Posted By

marcio on 01/25/10


Tagged

javascript jquery


Versions (?)

Anchor con efecto de transición


 / Published in: jQuery
 

  1. /*******
  2.  
  3. *** Anchor Slider by Cedric Dugas ***
  4. *** Http://www.position-absolute.com ***
  5.  
  6. Never have an anchor jumping your content, slide it.
  7.  
  8. Don't forget to put an id to your anchor !
  9. You can use and modify this script for any project you want, but please leave this comment as credit.
  10.  
  11. *****/
  12.  
  13. jQuery.fn.anchorAnimate = function(settings) {
  14.  
  15. settings = jQuery.extend({
  16. speed : 1100
  17. }, settings);
  18.  
  19. return this.each(function(){
  20. var caller = this
  21. $(caller).click(function (event) {
  22. event.preventDefault()
  23. var locationHref = window.location.href
  24. var elementClick = $(caller).attr("href")
  25.  
  26. var destination = $(elementClick).offset().top;
  27. $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
  28. window.location.hash = elementClick
  29. });
  30. return false;
  31. })
  32. })
  33. }

Report this snippet  

You need to login to post a comment.