/* Author : Hash Theme. Template Name: Canon - Agency Portfolio Template Version : 1.0 */ (function ($) { 'use strict'; function plugin_active() { $('#mainNav .navbar-nav li a,.canon-slide-buttons a').on('click', function (e) { var anchor = $(this); $('html, body').stop().animate({ scrollTop: $(anchor.attr('href')).offset().top - 48 }, 1000); e.preventDefault(); }); // Closes responsive menu when a scroll trigger link is clicked $('#mainNav .navbar-nav li a').on('click', function () { $('.navbar-collapse').collapse('hide'); }); // div custom background var pageSection = $("div"); pageSection.each(function(indx) { if ($(this).attr("data-background")) { $(this).css("background-image", "url(" + $(this).data("background") + ")"); } }); } function wc_hote() { if ($("#mainNav").offset().top > 80) { $("#mainNav").addClass("navbar-shrink"); } else { $("#mainNav").removeClass("navbar-shrink"); } } $(document).on('ready', function () { plugin_active(); }); $(window).on('scroll', function () { wc_hote(); }); })(jQuery);