46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
|
$( 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
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
});
|
||
|
|
||
|
});
|