$(document).ready(function () { /* * Funtion for the bx slider * */ $('.bxslider').bxSlider({ mode: 'horizontal', slideMargin: 3, speed:1500, infiniteLoop: true, autoDirection: 'prev', auto: true }); /* * * Function for the Nivo slider */ $('#slider').nivoSlider({ effect: 'boxRainGrowReverse', animSpeed: 500, pauseTime: 5000, directionNav: false, controlNav: false, controlNavThumbs: false, pauseOnHover: false, manualAdvance: false, randomStart: false }); /* * Function for create dynamic map * */ $("#map-address").each(function(){ var embed =""; $(this).html(embed); }); $("#map-address2").each(function(){ var embed =""; $(this).html(embed); }); }); /* * Function for the Sticky header * */ $(window).scroll(function () { if($(window).scrollTop() == 0) { $("#top-header").removeClass("small-header"); } else{ $("#top-header").addClass("small-header"); } }); $(window).scroll(function () { if($(window).scrollTop() == 0) { $("body-border").removeClass("bg-fixed"); } else{ $("body-border").addClass("bg-fixed"); } }); $(document).ready(function(){ $(window).scroll(function () { if($(window).scrollTop() == 0) { $("#logo-show-sm").removeClass("display-none"); } else{ $("#logo-show-sm").addClass("display-none"); } }); /* * Function for the Parallax image * */ var $window = $(window); //You forgot this line in the above example $('div[data-type="background"]').each(function(){ var $bgobj = $(this); // assigning the object $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // Put together our final background position var coords = '50% '+ yPos + 'px'; // Move the background $bgobj.css({ backgroundPosition: coords }); }); }); });