I'm having real trouble trying to get a div
to scroll on a page I'm building.
I basically have a div
element, which has a much wider div
inside that I want to scroll along to show different areas, and as such change the content. Basically a tab slider but a little different.
I've set it up currently to work on hover of the div
in question, the event triggers but nothing happens. Please help!.
The URL is: http://ram.grtest.com/ and click 'Join'. Hover over the content in there and the event should trigger. Don't click 'Next >' - that submits a form!
Here's the initialisation (test data, i'll adjust the amount of movement later)
$(开发者_开发技巧'#join-content').hover(function(){
$('#join-wrapper-scroll').scrollTo({axis: 'x',left:'+=100'}, 2000);
return false;
});
Thanks in advance!
Does #join-wrapper-scroll
have an inside layer before the content? I.e.
<div id="join-wrapper-scroll">
<ul> <!-- inner layer -->
<li>Content that scrolls.</li>
<li>Content that scrolls.</li>
</ul>
</div>
You need an "inner layer" or else the plugin won't understand what it's scrolling.
I think you want to use animate:
$("#join-wrapper-scroll").animate({"left": "-=600"}, 1000);
精彩评论