Schulchronik Vollständig
This commit is contained in:
80
public/js/load-photoswipe.js
Normal file
80
public/js/load-photoswipe.js
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
Put this file in /static/js/load-photoswipe.js
|
||||
Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/
|
||||
*/
|
||||
|
||||
/* Show an alert if this js file has been loaded twice */
|
||||
if (window.loadphotoswipejs) {
|
||||
window.alert("You've loaded load-photoswipe.js twice. See https://github.com/liwenyip/hugo-easy-gallery/issues/6")
|
||||
}
|
||||
var loadphotoswipejs = 1
|
||||
|
||||
/* TODO: Make the share function work */
|
||||
$( document ).ready(function() {
|
||||
/*
|
||||
Initialise Photoswipe
|
||||
*/
|
||||
var items = []; // array of slide objects that will be passed to PhotoSwipe()
|
||||
// for every figure element on the page:
|
||||
$('figure').each( function() {
|
||||
if ($(this).attr('class') == 'no-photoswipe') return true; // ignore any figures where class="no-photoswipe"
|
||||
// get properties from child a/img/figcaption elements,
|
||||
var $figure = $(this),
|
||||
$a = $figure.find('a'),
|
||||
$img = $figure.find('img'),
|
||||
$src = $a.attr('href'),
|
||||
$title = $img.attr('alt'),
|
||||
$msrc = $img.attr('src');
|
||||
// if data-size on <a> tag is set, read it and create an item
|
||||
if ($a.data('size')) {
|
||||
var $size = $a.data('size').split('x');
|
||||
var item = {
|
||||
src : $src,
|
||||
w : $size[0],
|
||||
h : $size[1],
|
||||
title : $title,
|
||||
msrc : $msrc
|
||||
};
|
||||
console.log("Using pre-defined dimensions for " + $src);
|
||||
// if not, set temp default size then load the image to check actual size
|
||||
} else {
|
||||
var item = {
|
||||
src : $src,
|
||||
w : 800, // temp default size
|
||||
h : 600, // temp default size
|
||||
title : $title,
|
||||
msrc : $msrc
|
||||
};
|
||||
console.log("Using default dimensions for " + $src);
|
||||
// load the image to check its dimensions
|
||||
// update the item as soon as w and h are known (check every 30ms)
|
||||
var img = new Image();
|
||||
img.src = $src;
|
||||
var wait = setInterval(function() {
|
||||
var w = img.naturalWidth,
|
||||
h = img.naturalHeight;
|
||||
if (w && h) {
|
||||
clearInterval(wait);
|
||||
item.w = w;
|
||||
item.h = h;
|
||||
console.log("Got actual dimensions for " + img.src);
|
||||
}
|
||||
}, 30);
|
||||
}
|
||||
// Save the index of this image then add it to the array
|
||||
var index = items.length;
|
||||
items.push(item);
|
||||
// Event handler for click on a figure
|
||||
$figure.on('click', function(event) {
|
||||
event.preventDefault(); // prevent the normal behaviour i.e. load the <a> hyperlink
|
||||
// Get the PSWP element and initialise it with the desired options
|
||||
var $pswp = $('.pswp')[0];
|
||||
var options = {
|
||||
index: index,
|
||||
bgOpacity: 0.8,
|
||||
showHideOpacity: true
|
||||
}
|
||||
new PhotoSwipe($pswp, PhotoSwipeUI_Default, items, options).init();
|
||||
});
|
||||
});
|
||||
});
|
||||
4
public/js/script.min.js
vendored
Normal file
4
public/js/script.min.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
(function($){'use strict';$(window).on('load',function(){$('.preloader').fadeOut(100);});$(window).scroll(function(){var height=$('.top-header').innerHeight();if($('header').offset().top>10){$('.top-header').addClass('hide');$('.navigation').addClass('nav-bg');$('.navigation').css('margin-top','-'+height+'px');}else{$('.top-header').removeClass('hide');$('.navigation').removeClass('nav-bg');$('.navigation').css('margin-top','-'+0+'px');}});$('[data-background]').each(function(){$(this).css({'background-image':'url('+$(this).data('background')+')'});});$('.hero-slider').slick({autoplay:true,autoplaySpeed:7500,pauseOnFocus:false,pauseOnHover:false,infinite:true,arrows:true,fade:true,prevArrow:'<button type=\'button\' class=\'prevArrow\'><i class=\'ti-angle-left\'></i></button>',nextArrow:'<button type=\'button\' class=\'nextArrow\'><i class=\'ti-angle-right\'></i></button>',dots:true});$('.hero-slider').slickAnimation();$(document).ready(function(){$('.venobox').venobox();});$(document).ready(function(){var containerEl=document.querySelector('.filtr-container');var filterizd;if(containerEl){filterizd=$('.filtr-container').filterizr({});}
|
||||
$('.filter-controls li').on('click',function(){$('.filter-controls li').removeClass('active');$(this).addClass('active');});});function counter(){var oTop;if($('.count').length!==0){oTop=$('.count').offset().top-window.innerHeight;}
|
||||
if($(window).scrollTop()>oTop){$('.count').each(function(){var $this=$(this),countTo=$this.attr('data-count');$({countNum:$this.text()}).animate({countNum:countTo},{duration:1000,easing:'swing',step:function(){$this.text(Math.floor(this.countNum));},complete:function(){$this.text(this.countNum);}});});}}
|
||||
$(window).on('scroll',function(){counter();});$(document).ready(function(){$('.has-animation').each(function(index){$(this).delay($(this).data('delay')).queue(function(){$(this).addClass('animate-in');});});});})(jQuery);
|
||||
Reference in New Issue
Block a user