Created
August 8, 2013 22:25
-
-
Save ilyakava/6189383 to your computer and use it in GitHub Desktop.
Partial Week08 Day04 Notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
<style> | |
#carousel { | |
position: relative; | |
margin: 50px auto; | |
} | |
#carousel > ul { | |
position: absolute; | |
/* left: -500; */ /*use this to move it*/ | |
height: 300px; | |
width: 2000px; | |
} | |
#carousel > ul > li { | |
float: left; | |
height: 300px; /* makes the clearfix superfluous sort of */ | |
width: 500px; | |
} | |
</style> | |
<body> | |
<div id="carousel"> | |
<ul class="group"> | |
<li>One</li> | |
<li>Two</li> | |
<li>Three</li> | |
<li>FOur</li> | |
</ul> | |
</div> | |
<script src="jsquery.js"></script> | |
<script> | |
var Carrousel = (function () { | |
var carrouself = $('#carrousel'); | |
var listHolder = carrousel.find("> ul"); | |
var listItems = listHolder.find("> li"); | |
var listItemsCount = listItems.length; | |
var listItemsWidth = listItems,first().width(); | |
var init = function () { | |
var totalWidth = listItemsCount * listItemsWidth; | |
// dynamically generated css | |
listHolder.css({"width": totalWidth + "px"}) | |
bind(); | |
} | |
var bind = function () { | |
} | |
var move = function () { | |
listHolder.css({"left": "-" + listItemWidth + "px"}) | |
} | |
return { | |
} | |
})(); | |
</script> | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment