// First, checks if it isn't implemented yet. | |
if (!String.prototype.format) { | |
String.prototype.format = function() { | |
var args = arguments; | |
return this.replace(/{(\d+)}/g, function(match, number) { | |
return typeof args[number] != 'undefined' | |
? args[number] | |
: match | |
; | |
}); | |
}; | |
} | |
(function($){ | |
$.fn.scrollingTo = function( opts ) { | |
var defaults = { | |
animationTime : 1000, | |
easing : '', | |
callbackBeforeTransition : function(){}, | |
callbackAfterTransition : function(){} | |
}; | |
var config = $.extend( {}, defaults, opts ); | |
$(this).click(function(e){ | |
var eventVal = e; | |
e.preventDefault(); | |
var $section = $(document).find( $(this).data('row') ); | |
if ( $section.length < 1 ) { | |
return false; | |
}; | |
if ( $('html, body').is(':animated') ) { | |
$('html, body').stop( true, true ); | |
}; | |
var scrollPos = $section.offset().top; | |
if ( $(window).scrollTop() == scrollPos ) { | |
return false; | |
}; | |
config.callbackBeforeTransition(eventVal, $section); | |
$('html, body').animate({ | |
'scrollTop' : ((scrollPos-100)+'px' ) | |
}, config.animationTime, config.easing, function(){ | |
config.callbackAfterTransition(eventVal, $section); | |
}); | |
}); | |
}; | |
}(jQuery)); | |
jQuery(document).ready(function(){ | |
"use strict"; | |
new WOW().init(); | |
(function(){ | |
jQuery('.smooth-scroll').scrollingTo(); | |
}()); | |
}); | |
// fancybox | |
$(".fancybox").fancybox({ | |
padding: 0, | |
openEffect : 'elastic', | |
openSpeed : 450, | |
closeEffect : 'elastic', | |
closeSpeed : 350, | |
closeClick : true, | |
helpers : { | |
title : { | |
type: 'inside' | |
}, | |
overlay : { | |
css : { | |
'background' : 'rgba(0,0,0,0.8)' | |
} | |
} | |
} | |
}); | |