2 lines
903 B
JavaScript
2 lines
903 B
JavaScript
/* Plugin for Cycle2; Copyright (c) 2012 M. Alsup; v20141007 */
|
|
!function(a){"use strict";a.extend(a.fn.cycle.defaults,{centerHorz:!1,centerVert:!1}),a(document).on("cycle-pre-initialize",function(b,c){function d(){clearTimeout(i),i=setTimeout(g,50)}function e(){clearTimeout(i),clearTimeout(j),a(window).off("resize orientationchange",d)}function f(){c.slides.each(h)}function g(){h.apply(c.container.find("."+c.slideActiveClass)),clearTimeout(j),j=setTimeout(f,50)}function h(){var b=a(this),d=c.container.width(),e=c.container.height(),f=b.outerWidth(),g=b.outerHeight();f&&(c.centerHorz&&d>=f&&b.css("marginLeft",(d-f)/2),c.centerVert&&e>=g&&b.css("marginTop",(e-g)/2))}if(c.centerHorz||c.centerVert){var i,j;a(window).on("resize orientationchange load",d),c.container.on("cycle-destroyed",e),c.container.on("cycle-initialized cycle-slide-added cycle-slide-removed",function(){d()}),g()}})}(jQuery); |