| Server IP : 89.248.107.232 / Your IP : 216.73.217.70 Web Server : Apache System : Linux host2.kasilh.com 5.14.0-687.36.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Aug 7 05:40:49 EDT 2026 x86_64 User : seg ( 10005) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/seg-sa.es/peyco.es/wp-content/themes/StoreFront/js/templates/ |
Upload File : |
/**
*
* -------------------------------------------
* Script for the template.gallery.php page style
* -------------------------------------------
*
**/
(function() {
"use strict";
var gkGalleryState = 0; // number of the current slide
var gkGalleryAnimationState = 'play'; // play|stop
var gkGalleryTimer = false;
// main onLoad event used to initialize the gallery
jQuery(window).load(function() {
if(jQuery('#gallery')) {
gkGalleryTimer = setTimeout(function() {
gkGalleryAutoanimation('next', null);
}, 5000);
// pagination
jQuery('#gallery').children('ol').find('li').each(function(i, btn) {
jQuery(btn).click(function() {
if(i !== gkGalleryState) {
gkGalleryAnimationState = 'stop';
gkGalleryAutoanimation('next', i);
}
});
});
if (jQuery('#gallery').find('.gallery-btn-prev')) {
jQuery('#gallery').find('.gallery-btn-prev').click(function(e) {
e.preventDefault();
gkGalleryAnimationState = 'stop';
gkGalleryAutoanimation('prev', null);
});
}
if (jQuery('#gallery').find('.gallery-btn-next')) {
jQuery('#gallery').find('.gallery-btn-next').click(function(e) {
e.preventDefault();
gkGalleryAnimationState = 'stop';
gkGalleryAutoanimation('next', null);
});
}
}
});
// gallery animation function
var gkGalleryAnimate = function(imgPrev, imgNext) {
imgPrev.animate({
opacity: 0
}, 500, function() {
imgPrev.attr('class', ' ');
});
imgNext.animate({
opacity: 1
}, 500, function(){
imgNext.attr('class', 'active');
gkGalleryTimer = setTimeout(function() {
gkGalleryAutoanimation('next', null);
}, 5000);
});
};
// gallery autoanimation function
var gkGalleryAutoanimation = function(dir, nextSlide) {
var i = gkGalleryState;
var imgs = jQuery('#gallery figure');
var next = nextSlide;
if(nextSlide === null) {
next = (dir === 'next') ? ((i < imgs.length - 1) ? i+1 : 0) : ((i === 0) ? imgs.length - 1 : i - 1); // dir: next|prev
}
if(gkGalleryAnimationState === 'stop') {
clearTimeout(gkGalleryTimer);
gkGalleryAnimationState = 'play';
}
gkGalleryAnimate(jQuery(imgs[i]), jQuery(imgs[next]));
gkGalleryState = next;
jQuery('#gallery').children('ol').find('li').attr('class', '');
jQuery(jQuery('#gallery').children('ol').find('li')[next]).attr('class', 'active');
};
})();