// Scrolls to the selected menu item on the page $(function() { $('a[href*=#]:not([href=#])').click(function() { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') || location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); if (target.length) { $('html,body').animate({ scrollTop: target.offset().top }, 1000); return false; } } }); }); $(document).ready(function(){ $('img').on('dragstart', function(){ return false; }); // Closes the sidebar menu $("#menu-close").click(function(e) { e.preventDefault(); $("#sidebar-wrapper").toggleClass("active"); }); // Opens the sidebar menu $("#menu-toggle").click(function(e) { e.preventDefault(); $("#sidebar-wrapper").toggleClass("active"); }); }); // scrolling-button--> jQuery(document).ready(function() { var offset = 220; var duration = 500; jQuery(window).scroll(function() { if (jQuery(this).scrollTop() > offset) { jQuery('.back-to-top').fadeIn(duration); } else { jQuery('.back-to-top').fadeOut(duration); } }); jQuery('.back-to-top').click(function(event) { event.preventDefault(); jQuery('html, body').animate({scrollTop: 0}, duration); return false; }) }); //_______________________________script for fixed header_________________________--> $(function(){ // Check the initial Poistion of the Sticky Header var stickyHeaderTop = $('#home').offset().top; $(window).scroll(function(){ if( $(window).scrollTop() > stickyHeaderTop ) { $('#home').css({position: 'fixed', top: '0px' , right: '0px' , left:'0px'}); $('.top-header').addClass("headscroll"); $('.logo-sun').addClass("headscrolling"); $('.nav').addClass("nav-resize"); $('#home').css('border-bottom' , '#ffa300 4px solid'); $('#clear').css('display', 'block'); } else { $('#home').css({position: 'relative', top: '0px'}); $('#clear').css('display', 'none'); $('.top-header').removeClass("headscroll"); $('.logo-sun').removeClass("headscrolling"); $('.nav').removeClass("nav-resize"); $('#home').css('border-bottom' , '4px solid rgba(28, 142, 231 , 0.4)'); } }); });