/*----------------------------------------------------------------------------------- /* /* Init JS /* -----------------------------------------------------------------------------------*/ jQuery(document).ready(function() { $WIN = $(window); /*----------------------------------------------------*/ /* Adjust Primary Navigation Background Opacity ------------------------------------------------------*/ $(window).on('scroll', function() { var h = $('header').height(); var y = $(window).scrollTop(); var header = $('#main-header'); if ((y > h + 0) && ($(window).outerWidth() > 1020)) { header.addClass('opaque'); } else { if (y < h + 2000) { header.removeClass('opaque'); } else { header.addClass('opaque'); } } }); /*----------------------------------------------------*/ /* slider /*----------------------------------------------------*/ // Slider Options $(".id-Slider").slick({ autoplay: true, autoplaySpeed: 5000, speed: 600, slidesToShow: 1, slidesToScroll: 1, pauseOnHover: true, dots: true, pauseOnDotsHover: true, cssEase: 'cubic-bezier(0.7, 0, 0.3, 1)', draggable: true, prevArrow: '', nextArrow: '', // Custom Dots With Thumbnails Tool Tip }); /* WOW Scrolling * ------------------------------------------------------ */ var wow = new WOW({ boxClass: 'wow', // animated element css class (default is wow) animateClass: 'animated', // animation css class (default is animated) offset: 100, // distance to the element when triggering the animation (default is 0) mobile: true, // trigger animations on mobile devices (default is true) live: true, // act on asynchronously loaded content (default is true) callback: function(box) {}, scrollContainer: null // optional scroll container selector, otherwise use window }); $(document).ready(function() { wow.init(); }); /* Smooth Scrolling * ------------------------------------------------------ */ $('.smoothscroll').on('click', function(e) { e.preventDefault(); var target = this.hash, $target = $(target); $('html, body').stop().animate({ 'scrollTop': $target.offset().top }, 800, 'swing', function() { window.location.hash = target; }); }); /* Back to Top * ------------------------------------------------------ */ // declare variable var scrollTop = $(".scrollTop"); $(window).scroll(function() { // declare variable var topPos = $(this).scrollTop(); // if user scrolls down - show scroll to top button if (topPos > 100) { $(scrollTop).css("opacity", "1"); } else { $(scrollTop).css("opacity", "0"); } }); // scroll END //Click event to scroll to top $(scrollTop).click(function() { $('html, body').animate({ scrollTop: 0 }, 300); return false; }); // click() scroll top EMD /* Initialize * ------------------------------------------------------ */ (function ssInit() { })(); }); (jQuery);