/*! lightgallery - v1.2.0 - 2015-08-26
* http://sachinchoolur.github.io/lightgallery/
* copyright (c) 2015 sachin n; licensed apache 2.0 */
(function($, window, document, undefined) {
'use strict';
var defaults = {
pager: false
};
var pager = function(element) {
this.core = $(element).data('lightgallery');
this.$el = $(element);
this.core.s = $.extend({}, defaults, this.core.s);
if (this.core.s.pager && this.core.$items.length > 1) {
this.init();
}
return this;
};
pager.prototype.init = function() {
var _this = this;
var pagerlist = '';
var $pagercont;
var $pagerouter;
var timeout;
_this.core.$outer.find('.lg').append('
');
if (_this.core.s.dynamic) {
for (var i = 0; i < _this.core.s.dynamicel.length; i++) {
pagerlist += '';
}
} else {
_this.core.$items.each(function() {
if (!_this.core.s.exthumbimage) {
pagerlist += '';
} else {
pagerlist += '';
}
});
}
$pagerouter = _this.core.$outer.find('.lg-pager-outer');
$pagerouter.html(pagerlist);
$pagercont = _this.core.$outer.find('.lg-pager-cont');
$pagercont.on('click.lg touchend.lg', function() {
var _$this = $(this);
_this.core.index = _$this.index();
_this.core.slide(_this.core.index, false, false);
});
$pagerouter.on('mouseover.lg', function() {
cleartimeout(timeout);
$pagerouter.addclass('lg-pager-hover');
});
$pagerouter.on('mouseout.lg', function() {
timeout = settimeout(function() {
$pagerouter.removeclass('lg-pager-hover');
});
});
_this.core.$el.on('onbeforeslide.lg.tm', function(e, previndex, index) {
$pagercont.removeclass('lg-pager-active');
$pagercont.eq(index).addclass('lg-pager-active');
});
};
pager.prototype.destroy = function() {
};
$.fn.lightgallery.modules.pager = pager;
})(jquery, window, document);