patternlibrary/assets/js/script.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-06-21 01:38:13 +00:00
$( document ).ready(function() {
// Open side navbar for handsets
$('.navbar-burger').on('click tap', function(e) {
$(this).toggleClass('is-active');
$(this).parent().parent().find('#navbar-menu').toggleClass('is-active');
});
// Swap navbar colors with ScrollMagic.js
var controller = new ScrollMagic.Controller();
var sections = $('section[data-headerbg]');
$.each(sections, function(index,item){
var el = $(item),
elClass = el.data('headerbg') + '-header',
headerEl = $('#navbar');
new ScrollMagic.Scene({
triggerElement: el,
triggerHook: 'onLeave',
duration: el.outerHeight()
})
.offset(el.offset().top - headerEl.outerHeight())
.on("enter",function(e){headerEl.addClass(elClass)})
.on("leave",function(e){headerEl.removeClass(elClass)})
.addTo(controller);
});
// Slick carousel
$('.carousel').slick({
arrows: false,
centerMode: true,
centerPadding: '0',
slidesToShow: 3,
dots: true,
responsive: [
{
breakpoint: 600,
settings: {
slidesToShow: 1
}
}
]
});
});