(function ($) {$(document).ready(function() { // frontpage slider if( $(window).width() >= 768 ){ $('.view-slider .view-content').orbit({ fluid: '16x6', captions:true, captionAnimation: 'slideOpen', captionAnimationSpeed: 900 }); }else{ $('.view-slider .view-content').orbit({ fluid: '16x12', captions:true, captionAnimation: 'slideOpen', captionAnimationSpeed: 900 }); } $('#featured').orbit({ fluid: '16x6', captions:true, captionAnimation: 'slideOpen', captionAnimationSpeed: 900 }); // testimonial slider $('.view-testimonials .view-content').orbit({ fluid: '16x6', animationSpeed: 300, animation: 'vertical-slide', pauseOnHover: true, startClockOnMouseOut: true }); // scroll to top button $('#to-top').click(function() { $("html, body").animate({scrollTop: 0}, 500); return false; }); //////// Parallax /////// if( $(window).width() > 768 ){ $('.works-pane').parallax("50%", 0.4); $('.blog-pane').parallax("50%", 0.4); } $(window).scroll(function() { set_header_left(); var windowWidth = $(window).width() if ($(this).scrollTop() > $('.header-row').height()) { $('#to-top').fadeIn(); if(windowWidth > 768){ $('.top-notification-block').hide(); $('.header-row').addClass('sticky'); $('.page-contener').addClass('sticky-contener'); } } else { $('.top-notification-block').show(); $('#to-top').fadeOut(); $('.header-row').removeClass('sticky'); $('.page-contener').removeClass('sticky-contener'); } set_header_left(); if( $(window).width() > 768 ){ // inteligent slider caption $(".view-slider .orbit-wrapper").each(function(index, element) { $('.orbit-wrapper .orbit-caption').css('top', ($(window).scrollTop() * 0.55) + 100 ); }); } }); $(window).resize(function() { set_header_left(); }); function set_header_left(){ if( $('.header-row').hasClass('sticky') ){ $('.header-row').css('left', 0 ); }else{ $('.header-row').css('left', ($('.page-contener').width() - $('.header-row').width()) / 2 ); $('.orbit-wrapper .orbit-caption').css('left', ($('.page-contener').width() - $('.header-row').width()) / 2 ); } } set_header_left(); $(".header-row .logo-contener").hover( function () { $('.header-row .social-footer').addClass("hover"); }, function () { $('.header-row .social-footer').removeClass("hover"); } ); // redirect after dropdown menu change $(".redirect-onchange").change(function() { window.location = $(this).find("option:selected").val(); }); // style switcher $('.styleswitcher .schemas a').click(function(event) { event.preventDefault(); var title = $(this).attr('title'); if (document.createStyleSheet){ document.createStyleSheet(Drupal.settings.basePath+'/profiles/asafou/themes/asafou/css/color/"+title+".css'); } else { $("head").append($(" ")); } console.log(Drupal.settings.basePath); }); var movementsize = 160; $('.styleswitcher-contener .selector').click(function() { $('.styleswitcher').animate({ left: '+=' + movementsize }, 500, function() { movementsize = movementsize * -1; } ); }); /////////////////////////////////////////////////////////////////////////////////////// });})(jQuery);