2

I've been trying to make a custom scroll using jQuery and CSS and I've been partially successful. The problem is I can't figure out how to stop the scroll bar when it reaches the limit of its scroll-container. I just need to find the code section which is not letting this happen. It'd be great if someone could help with the script. I have the whole thing up and running on http://jsfiddle.net/ithril/va6DW/

0

1 Answer 1

3

Here's a quick fix: add the folowing condition before moving the scroll:

if(x-35>left_limit && x-20<right_limit)

Full code here: http://jsfiddle.net/dujaQ/


But i strongly suggest you to take an existing jquery plugin and adapt it to your need. Here some jquery scroll plugins with horizontal scroll support:

  1. mCustomScrollbar
  2. jScrollPane
Sign up to request clarification or add additional context in comments.

2 Comments

I use jScrollPane and it works like a charm, so i wouls suggest that. Fully customisable also :)
Thanks a lot for the solution. Could you provide me a decent link that explains how to use jScrollPane,I tried using it but its because i dont know how to customize it and stuff. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.