Add smooth scroll and sticky scripts

This commit is contained in:
Michael Rose
2016-03-10 13:06:17 -05:00
parent caefcce729
commit 3df0afbdc9
5 changed files with 54 additions and 19 deletions

View File

@ -2,33 +2,51 @@
jQuery plugin settings and other scripts
========================================================================== */
/* fitvids.js */
$(document).ready(function(){
$(function() {
$("article").fitVids();
});
// FitVids init
$("#main").fitVids();
// init sticky sidebar
$(".sticky").Stickyfill();
// init smooth scroll
$("a").smoothScroll({offset: -20});
/* add lightbox class to all image links */
// add lightbox class to all image links
$("a[href$='.jpg'],a[href$='.jpeg'],a[href$='.JPG'],a[href$='.png'],a[href$='.gif']").addClass("image-popup");
$("a[href$='.jpg'],a[href$='.jpeg'],a[href$='.JPG'],a[href$='.png'],a[href$='.gif']").addClass("image-popup");
/* Magnific-Popup options */
$(document).ready(function() {
// Magnific-Popup options
$(".image-popup").magnificPopup({
type: "image",
tLoading: "Loading image #%curr%...",
disableOn: function() {
if( $(window).width() < 500 ) {
return false;
}
return true;
},
type: 'image',
tLoading: 'Loading image #%curr%...',
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [0,1] // will preload 0 - before current, and 1 after the current image
preload: [0,1] // Will preload 0 - before current, and 1 after the current image
},
image: {
tError: "<a href='%url%'>Image #%curr%</a> could not be loaded.",
tError: '<a href="%url%">Image #%curr%</a> could not be loaded.',
},
removalDelay: 300, // delay in milliseconds before popup is removed
mainClass: "mfp-fade"
removalDelay: 500, // Delay in milliseconds before popup is removed
// Class that is added to body when popup is open.
// make it unique to apply your CSS animations just to this exact popup
mainClass: 'mfp-zoom-in',
callbacks: {
beforeOpen: function() {
// just a hack that adds mfp-anim class to markup
this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
}
},
closeOnContentClick: true,
midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source.
});
});