0

I want my link to animate scroll horizontally across the page to the desired "id" rather then jumping to it. this is what I have so far but it doesn't seem to be working.

HTML:

<div class = option1> 
  <a href= #point1> ➟ </a>
</div>

<div id = point1></div>
<!-- id point is not in the "body" of the link? does that matter? --> 

CSS:

body {
  min-height:100%;
  height:100%;
  margin:0;
  width:auto;
}

html {
  min-height:100%;
  height:100%;
  overflow-y:hidden;
  width:100% }

JavaScript:

$(document).ready({ 
  $(function() {
    $('ul.nav a').bind('click',function(event){
      var $anchor = $(this);
      $('html, body').stop().animate({
        scrollLeft: $($anchor.attr('href')).offset().left
      }, 15000);
      event.preventDefault();
    });
  });
}); 
I'm Geeker
  • 4,601
  • 5
  • 22
  • 41
sosro
  • 35
  • 5

1 Answers1

0

Please try use class="name" not class=name

over wise this looks similar: Smooth scrolling when clicking an anchor link

Community
  • 1
  • 1