Browse Source

New packed version

pull/2/merge
Viljami S 13 years ago
parent
commit
4c0e468819
  1. 2
      adaptiveslides.pack.js

2
adaptiveslides.pack.js

@ -1,2 +1,2 @@
/*! AdaptiveSlides.js v1.0. (c) 2011 Viljami Salminen. MIT License. http://adaptiveslides.viljamis.com */
(function(a){a.fn.adaptiveSlides=function(b){var c={speed:4e3,fade:1e3,auto:true,maxwidth:"none",namespace:"adaptiveSlides"};return this.each(function(){var d=a(this);if(b){a.extend(c,b)}if(d.find("img").length<=1){return}var e=function(){d.find("img").each(function(b){var d=a(this);d.attr({id:c.namespace+"_slide"+b})});d.find("img").css({top:0,left:0,width:"100%",height:"inherit",position:"absolute"});d.find(":first-child").addClass(c.namespace+"_visible");d.css({"max-width":parseFloat(c.maxwidth),width:"100%",overflow:"hidden",position:"relative"});heightFix=["<style>","."+c.namespace+"_visible {","position: relative !important;","float: left !important;","}","</style>"].join("");a("head").append(heightFix);if(c.auto===true){d.find("img:gt(0)").hide();setInterval(function(){d.find(":first-child").fadeOut(parseFloat(c.fade)).next("img").fadeIn(parseFloat(c.fade)).addClass(c.namespace+"_visible").end().appendTo(d).removeClass(c.namespace+"_visible")},parseFloat(c.speed))}else{var b=a('<ul class="'+c.namespace+'_tabs" />'),e=d.find("img"),f=e.length;d.find("img:gt(0)").hide();while(f--){var g=f+1;tabMarkup=["<li>",'<a href="#'+c.namespace+"_slide"+f+'"','class="'+c.namespace+"_slide"+f+'">'+g+"</a>","</li>"].join("");b.prepend(tabMarkup)}d.after(b);a("."+c.namespace+"_slide0").parent().addClass("active");a("."+c.namespace+"_tabs a").each(function(b){var d=a(this);d.click(function(e){e.preventDefault();if(a("."+c.namespace+"_visible:animated").length){return false}if(!d.parent().hasClass("active")){a("."+c.namespace+"_tabs li").removeClass("active");a("."+c.namespace+"_visible").stop().fadeOut(parseFloat(c.fade),function(){a(this).removeClass(c.namespace+"_visible")}).end();a("#"+c.namespace+"_slide"+b).stop().fadeIn(parseFloat(c.fade),function(){a(this).addClass(c.namespace+"_visible")}).end();d.parent().addClass("active")}})})}};var f=function(){if(b.maxwidth){if(typeof document.body.style.maxHeight!=="undefined"&&typeof document.body.style.minHeight!=="undefined"){return false}else{d.each(function(){d.css("width","100%");if(d.width()>parseFloat(c.maxwidth)){d.css("width",parseFloat(c.maxwidth))}else if(d.width()<parseFloat(c.maxwidth)){d.css("width","100%")}})}}};e();f();a(window).resize(function(){f()})})}})(jQuery)
(function(a){a.fn.adaptiveSlides=function(b){var c={speed:4e3,fade:1e3,auto:true,maxwidth:"none",namespace:"adaptiveSlides"};return this.each(function(){var d=a(this);if(b){a.extend(c,b)}if(d.find("img").length<=1){return}var e=function(){var b=d.find("img");b.each(function(b){var d=a(this);d.attr({id:c.namespace+"_slide"+b})});b.css({top:0,left:0,width:"100%",height:"inherit",position:"absolute"});d.find(":first-child").addClass(c.namespace+"_visible");d.css({"max-width":parseFloat(c.maxwidth),width:"100%",overflow:"hidden",position:"relative"});heightFix=["<style>","."+c.namespace+"_visible {","position: relative !important;","float: left !important;","}","</style>"].join("");a("head").append(heightFix);if(c.auto===true){d.find("img:gt(0)").hide();setInterval(function(){d.find(":first-child").fadeOut(parseFloat(c.fade)).next("img").fadeIn(parseFloat(c.fade)).addClass(c.namespace+"_visible").end().appendTo(d).removeClass(c.namespace+"_visible")},parseFloat(c.speed))}else{var e=a('<ul class="'+c.namespace+'_tabs" />');d.find("img:gt(0)").hide();b.each(function(a){var b=a+1;tabMarkup=["<li>",'<a href="#'+c.namespace+"_slide"+b+'"','class="'+c.namespace+"_slide"+b+'">'+b+"</a>","</li>"].join("");e.append(tabMarkup)});d.after(e);a("."+c.namespace+"_slide1").parent().addClass("active");a("."+c.namespace+"_tabs a").each(function(b){var d=a(this);d.click(function(e){e.preventDefault();if(a("."+c.namespace+"_visible:animated").length){return false}if(!d.parent().hasClass("active")){a("."+c.namespace+"_tabs li").removeClass("active");a("."+c.namespace+"_visible").stop().fadeOut(parseFloat(c.fade),function(){a(this).removeClass(c.namespace+"_visible")}).end();a("#"+c.namespace+"_slide"+b).stop().fadeIn(parseFloat(c.fade),function(){a(this).addClass(c.namespace+"_visible")}).end();d.parent().addClass("active")}})})}};var f=function(){if(b.maxwidth){if(typeof document.body.style.maxHeight!=="undefined"&&typeof document.body.style.minHeight!=="undefined"){return false}else{d.each(function(){d.css("width","100%");if(d.width()>parseFloat(c.maxwidth)){d.css("width",parseFloat(c.maxwidth))}else if(d.width()<parseFloat(c.maxwidth)){d.css("width","100%")}})}}};e();f();a(window).resize(function(){f()})})}})(jQuery)
Loading…
Cancel
Save