2013-05-11 06:16:11 -04:00
|
|
|
/**
|
2013-08-25 20:35:53 -04:00
|
|
|
* Main JS file for Casper behaviours
|
2013-05-11 06:16:11 -04:00
|
|
|
*/
|
|
|
|
|
2014-09-07 16:21:06 -04:00
|
|
|
/* globals jQuery, document */
|
2015-02-18 23:46:35 -05:00
|
|
|
(function ($, undefined) {
|
2013-05-11 06:16:11 -04:00
|
|
|
"use strict";
|
|
|
|
|
2015-02-18 23:46:35 -05:00
|
|
|
var $document = $(document);
|
2014-09-07 16:21:06 -04:00
|
|
|
|
|
|
|
$document.ready(function () {
|
|
|
|
|
|
|
|
var $postContent = $(".post-content");
|
|
|
|
$postContent.fitVids();
|
|
|
|
|
2014-07-22 07:21:33 -04:00
|
|
|
$(".scroll-down").arctic_scroll();
|
|
|
|
|
2015-02-27 09:48:15 -05:00
|
|
|
$(".menu-button, .nav-cover, .nav-close").on("click", function(e){
|
|
|
|
e.preventDefault();
|
|
|
|
$("body").toggleClass("nav-opened nav-closed");
|
|
|
|
});
|
|
|
|
|
2013-05-11 06:16:11 -04:00
|
|
|
});
|
2013-08-20 12:53:02 -04:00
|
|
|
|
2014-09-07 16:21:06 -04:00
|
|
|
// Arctic Scroll by Paul Adam Davis
|
|
|
|
// https://github.com/PaulAdamDavis/Arctic-Scroll
|
2014-07-22 07:21:33 -04:00
|
|
|
$.fn.arctic_scroll = function (options) {
|
|
|
|
|
|
|
|
var defaults = {
|
|
|
|
elem: $(this),
|
|
|
|
speed: 500
|
2014-09-07 16:21:06 -04:00
|
|
|
},
|
2014-07-22 07:21:33 -04:00
|
|
|
|
2014-09-07 16:21:06 -04:00
|
|
|
allOptions = $.extend(defaults, options);
|
|
|
|
|
|
|
|
allOptions.elem.click(function (event) {
|
2014-07-22 07:21:33 -04:00
|
|
|
event.preventDefault();
|
2014-09-07 16:21:06 -04:00
|
|
|
var $this = $(this),
|
|
|
|
$htmlBody = $('html, body'),
|
|
|
|
offset = ($this.attr('data-offset')) ? $this.attr('data-offset') : false,
|
|
|
|
position = ($this.attr('data-position')) ? $this.attr('data-position') : false,
|
|
|
|
toMove;
|
|
|
|
|
2014-07-22 07:21:33 -04:00
|
|
|
if (offset) {
|
2014-09-07 16:21:06 -04:00
|
|
|
toMove = parseInt(offset);
|
|
|
|
$htmlBody.stop(true, false).animate({scrollTop: ($(this.hash).offset().top + toMove) }, allOptions.speed);
|
2014-07-22 07:21:33 -04:00
|
|
|
} else if (position) {
|
2014-09-07 16:21:06 -04:00
|
|
|
toMove = parseInt(position);
|
|
|
|
$htmlBody.stop(true, false).animate({scrollTop: toMove }, allOptions.speed);
|
2014-07-22 07:21:33 -04:00
|
|
|
} else {
|
2014-09-07 16:21:06 -04:00
|
|
|
$htmlBody.stop(true, false).animate({scrollTop: ($(this.hash).offset().top) }, allOptions.speed);
|
2014-07-22 07:21:33 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
2015-02-18 23:46:35 -05:00
|
|
|
})(jQuery);
|