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 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2006
    Posts
    42
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Jquery ScrollTo covers a greater distance on each click

    Hi I was hoping someone could help.

    I'm using the ScrollTo jquery plugin..and on each click to scroll towards the left it incrementally covers a greater distance....conversely clicking to scroll towards the right sending the items back the other way incrementally covers a lesser distance.

    You can see the example

    here http://psd2htmlservice.com/scrolltest/index2.html

    I was wondering if people could view the source to have a better look at what's going on but the actual code I'm using to invoke the function is this

    Code:
    <script language="javascript" type="text/javascript">
    $(document).ready(function() { 
        	   
                
          $("#streetstyles_right_arrow").click(function(){
          $("#streetstyles-pane").scrollTo({top:'+=0px',left:'+=470px'}, 370);
          $("#streetstyles-pane2").scrollTo({top:'+=0px',left:'+=470px'}, 370);
          });
    
          $("#streetstyles_left_arrow").click(function(){
          $("#streetstyles-pane").scrollTo({top:'+=0px',left:'-=470px'}, 370);
          $("#streetstyles-pane2").scrollTo({top:'+=0px',left:'-=470px'}, 370);
          });
                
          });
          
    </script>
    Any help would be much appreciated.

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    why are you putting += and -= on the css properties?

  • #3
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    also part of your pblem lies in your margins and padding for the LI's


  •  

    Posting Permissions

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