Created
June 8, 2011 12:34
-
-
Save RStankov/1014327 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).delegate('[data-action="scroll"]', 'click', function() { | |
var scrollToId = $(this).attr('href').split('#')[1]; | |
if (document.getElementById(scrollToId)){ | |
$.scrollTo('#' + scrollToId, { | |
duration: 800, | |
onAfter: function(){ window.location.hash = '#' + scrollToId; } | |
}); | |
return false; | |
} | |
}); | |
$(document).delegate('[data-action="print"]', 'click', function() { | |
window.print(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="faq#question-1" data-action="scroll">Question 1</a> | |
<a href="faq#question-2" data-action="scroll">Question 2</a> | |
<button data-action="print">Print</button> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment