Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. function goToByScroll(id){
  2. // Reove "link" from the ID
  3. id = id.replace("link", "");
  4. // Scroll
  5. $('html,body').animate({
  6. scrollTop: $("#"+id).offset().top},
  7. 'slow');
  8. }
  9.  
  10. $("#sidebar > ul > li > a").click(function(e) {
  11. // Prevent a page reload when a link is pressed
  12. e.preventDefault();
  13. // Call the scroll function
  14. goToByScroll($(this).attr("id"));
  15. });
  16.  
  17. var $j = jQuery.noConflict();
  18.  
  19. $j(document).ready(function(){
  20. $j("#test").css("padding","10px");
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement