forked from benbyford/stopmotion-lite.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstopmotion-lite_1.1.min.js
More file actions
13 lines (13 loc) · 1.23 KB
/
Copy pathstopmotion-lite_1.1.min.js
File metadata and controls
13 lines (13 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
/*!
* stopmotion-lite.js
* by Ben Byford
*
* Examples and documentation at: http://www.benbyford.com/
* Version: 1.1 (29-MAY-2011)
* Licensed under Creative Commons - Attribution 3.0 Unported (CC BY 3.0).
* http://creativecommons.org/licenses/by/3.0/
* Requires: jQuery v1.2 or later
*/
function stopmotion(a,b,c){a=typeof(a)!="undefined"?a:slideImages;b=typeof(b)!="undefined"?b:"100";c=typeof(c)!="undefined"?c:"1";if(c==1){$(a).parent().prepend('<div id="playPause"></div>')}$(a).children().css("position","absolute");
$(a).find(":first-child").addClass("slideOn first");$imgNum=$(a).children().length;$i="0";$(window).load(function(){$a="0";$pause="0";$("#playPause").css("display","block").bind("click",function(){if($a=="0"){$(this).css("background-position","0px -20px");$a="1";$pause="1"}else{$(this).css("background-position","0px 0px");$a="0";$pause="0";e()}});$(a).animate({opacity:1},500,f);function d(){$(".slideOn").css("display","none").css("z-index","0").removeClass("slideOn").next().addClass("slideOn").css("z-index",$imgNum).css("display","block");
if($i==$imgNum){$i="1";$(".first").addClass("slideOn")}else{$i++}e()}function e(){if($pause=="0"){var g=setTimeout(d,b)}else{}}function f(){$("#loading").fadeOut(500).remove();e()}})};