fathima
fathima

Reputation: 125

How to scroll the webpages horizantally when navigation button is clicked?

I have spent the last days looking for a simple javascript or jquery code for this. I want to incorporate a horizontal scrolling when navigation button is clicked ,The pages content should move left to right.

It would function very similar to the scrolling shown here:

http://codecanyon.net/item/fss-full-screen-sliding-website-plugin/full_screen_preview/159103

Upvotes: 0

Views: 92

Answers (1)

Opi
Opi

Reputation: 1308

Try the scrollLeft and/or scrollTop methods:

https://developer.mozilla.org/en/DOM/element.scrollLeft

Use it in a nested container:

<div id="myDiv" style="width:100px;overflow:hidden">
 <div>LONGTEXTLONGTEXTLONGTEXTLONGTEXTLONGTEXTLONGTEXTLONGTEXTLONGTEXT...</div>
</div>
<input type="button" onclick="document.getElementById('myDiv').scrollLeft += 10" value="Scroll!"/>

Upvotes: 1

Related Questions