Using siteSlider create slides, which you can scroll to the right or left. Let's say you have four elements in the code marked by the same class - for example <div class="frame"></div> - each with a different content. When the script runs, it assigns to each of these elements the same height and width, as the browser window actually has. Then assigns a previously declared elements of navigation functions, through which the scroll is carried out to further elements to the left - or right.
Demo included, just download.
At first, we have to set some markup. In general, we need to create elements which will hold some content, with the same class - for example frame. Then add elements, which should be our triggers for sliding site. The last thing out there, is to put elements (for example list with <li> nodes), equal in number of frame class holders.
<div id="container"> <div id="controls"> <div id="sliderLeft">click to move slider left</div> <div id="sliderRight">click to move slider right</div> <ul id="selectFrame"> <li class="link"><a href="#">frame 1</a></li> <li class="link"><a href="#">frame 2</a></li> <li class="link"><a href="#">frame 3</a></li> <li class="link"><a href="#">frame 4</a></li> </ul> </div> <div class="frame"> <p>content of frame 1</p> </div> <div class="frame"> <p>content of frame 2</p> </div> <div class="frame"> <p>content of frame 3</p> </div> <div class="frame"> <p>content of frame 4</p> </div> </div>
Then, we should add some styling:
body { overflow:hidden; } #container { overflow:hidden; } #controls ul { position:absolute; top:150px; left:150px; } #controls li { float:left; margin:0 10px; } #sliderLeft, #sliderRight { position:absolute; top:50%; width:80px; height:80px; margin-top:-40px; cursor:pointer; background:#AFAFAF; } #sliderLeft { left:0; } #sliderRight { right:0; } .frame { float:left; height:100%; width:100%; overflow:hidden; }
IMPORTANT thing if We want to use it also in IE7 !
add that line to styles used for IE7 (ie. HTML conditional comments providing IE7 specified stylesheets or hacks, like in this demo ;))
html { overflow: auto; }
Last thing, is to include some js code running our slider !
window.addEvent('domready', function() { var ss = new SiteSlider({ frames: '.frame', navs: ['sliderLeft', 'sliderRight'], duration: 700, transition: Fx.Transitions.Quad.easeInOut, menuNav: true, menuNavName: 'selectFrame' }); });
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus