[ Mini Kiebo ]
Server: Windows NT DESKTOP-5B8S0D4 6.2 build 9200 (Windows 8 Professional Edition) i586
Path:
D:
/
xampp182
/
htdocs
/
simkeu
/
keuangan
/
vendors
/
bower_components
/
lightgallery
/
src
/
js
/
[
Home
]
File: lg-hash.js
(function($, window, document, undefined) { 'use strict'; var defaults = { hash: true }; var Hash = function(element) { this.core = $(element).data('lightGallery'); this.core.s = $.extend({}, defaults, this.core.s); if (this.core.s.hash) { this.oldHash = window.location.hash; this.init(); } return this; }; Hash.prototype.init = function() { var _this = this; var _hash; // Change hash value on after each slide transition _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex, index) { window.location.hash = 'lg=' + _this.core.s.galleryId + '&slide=' + index; }); // Listen hash change and change the slide according to slide value $(window).on('hashchange.lg.hash', function() { _hash = window.location.hash; var _idx = parseInt(_hash.split('&slide=')[1], 10); // it galleryId doesn't exist in the url close the gallery if ((_hash.indexOf('lg=' + _this.core.s.galleryId) > -1)) { _this.core.slide(_idx, false, false); } else if (_this.core.lGalleryOn) { _this.core.destroy(); } }); }; Hash.prototype.destroy = function() { if (!this.core.s.hash) { return; } // Reset to old hash value if (this.oldHash && this.oldHash.indexOf('lg=' + this.core.s.galleryId) < 0) { window.location.hash = this.oldHash; } else { if (history.pushState) { history.pushState('', document.title, window.location.pathname + window.location.search); } else { window.location.hash = ''; } } this.core.$el.off('.lg.hash'); }; $.fn.lightGallery.modules.hash = Hash; })(jQuery, window, document);