To be able to use the HoverScroll plugin you must first include the script and css in the head section of your page along with the jquery library.
><head>
link type="text/css" rel="stylesheet" href="jquery.hoverscroll-0.1.0.css" />
     script type="text/javascript" src="jquery.js">script>script type="text/javascript" src="jquery.hoverscroll-0.1.0.js">script>
head>
Then, you will need some html markup:
1.<ul id="my-list">2.    <li style="width:67px; height:50px;"><img src="images/maja1_th.jpg" />li>3.    <li style="width:67px; height:50px;"><img src="images/maja2_th.JPG" />li>4.    <li style="width:67px; height:50px;"><img src="images/maja3_th.JPG" />li>5.    <li style="width:67px; height:50px;"><img src="images/maja4_th.JPG" />li>6.ul> 		Note for horizontal HoverScrolls:
		The width and height is specified on each list item because if the images are not loaded as fast 		as the code (which happens often) the script cannot reliably determine the width of the content.
When this happens only one item is shown from the list. Generating HoverScrolls upon the window.onload event within a 10ms setTimeout call and specifying the width and height of each item (in the html or in a separate css file) can resolve this problem. The sample above was generated by a php script which determines each images width and height and prints it out in the html, but it is abit useless in this example as all the images have the same size. 
 Finally, in the head again (after including the scripts) add the following block of code to generate the HoverScroll and you're all good to go!
		This creates a horizontal hover scroll list (see further down for default parameters control). 	
1.<script type="text/javascript">2.$(document).ready(function() {3.    $('#my-list').hoverscroll();4.});5.script>View the complete source of this example
Plugin reference
Generated markup
Here is a sample of markup generated by hoverscroll (note: you must not use this markup in your code else HoverScroll will not work properly) :
01.<div class="ui-widget-content hoverscroll horizontal">02.    <div class="listcontainer">03.        <ul id="my-list" class="list ui-helper-clearfix">04.            <li class="item"><img src="images/maja1_th.jpg" />li>05.            <li class="item"><img src="images/maja2_th.JPG" />li>06.            <li class="item"><img src="images/maja3_th.JPG" />li>07.            <li class="item"><img src="images/maja4_th.JPG" />li>08.            <li class="item"><img src="images/maja5_th.JPG" />li>09.            <li class="item"><img src="images/maja6_th.JPG" />li>10.            <li class="item"><img src="images/maja7_th.JPG" />li>11.            <li class="item"><img src="images/maja8_th.JPG" />li>12.            <li class="item"><img src="images/maja9_th.JPG" />li>13.            <li class="item"><img src="images/maja10_th.JPG" />li>14.        ul>15.        <div class="arrow left">div>16.        <div class="arrow right">div>17.    div>18.div> 		As you can see, HoverScroll integrates with the jQuery UI by implementing one of its CSS classes.
 
 
No comments:
Post a Comment