Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    May 2011
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Having troubles implementing jquery

    I'm having trouble implementing jquery horizontal smooth scrolling.

    This is the html

    <div class="nav">
    <ul>
    <li><a href="#home">Home</a></li>
    <li><a href="#about">About</a></li>
    <li><a href="#portfolio">Portfolio</a></li>
    <li><a href="#contact">Contact</a></li>
    </ul>
    </div>

    <div id="home" class="panel"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. </div>


    <div id="blank" class="panel"></div> <div id="blank" class="panel"></div>

    <div id="about" class="panel"> <h1>asdfsadfasdfasd</h1> </div>

    <div id="blank" class="panel"></div> <div id="blank" class="panel"></div>

    <div id="portfolio" class="panel"> <h1>Llkasdjfkljasdklfad</h1> </div>

    <div id="blank" class="panel"></div> <div id="blank" class="panel"></div>

    <div id="contact" class="panel"> <h1>klsdklfjaskldfjklasd</h1> </div>

    <div id="blank" class="panel"></div> <div id="blank" class="panel"></div>

    </div>
    and this is the js

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <script type="text/javascript" src="jquery.easing.1.3.js"></script>
    <script type="text/javascript">
    $(function() {
    $('panel').bind('click',function(event){
    var $anchor = $(this);
    /*
    if you want to use one of the easing effects:
    $('html, body').stop().animate({
    scrollLeft: $($anchor.attr('href')).offset().left
    }, 1500,'easeInOutExpo');
    */
    $('html, body').stop().animate({
    scrollLeft: $($anchor.attr('href')).offset().left
    }, 1000);
    event.preventDefault();
    });
    });
    </script>
    and yes I do have the jquery.easing.1.3.js in the same file as my index.html
    I think I did something wrong with the js, do you guys see anything rwong?

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    wrong forum, you wanna post in javascript

  • #3
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    $('panel') should be $(".panel") , btw

  • #4
    New Coder
    Join Date
    May 2011
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts
    woopsy thank you (:


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •