Forked from ShiponKarmakar/Header Top Fix Function.js
Created
January 14, 2018 07:15
-
-
Save mjinayan80/616f755da8b6907a294d6f92755d5e1c to your computer and use it in GitHub Desktop.
Jquery All Source
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.count').each(function () { | |
$(this).prop('Counter',0).animate({ | |
Counter: $(this).text() | |
}, { | |
duration: 4000, | |
easing: 'swing', | |
step: function (now) { | |
$(this).text(Math.ceil(now)); | |
} | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check the initial Poistion of the Sticky Header | |
var stickyHeaderTop = $('#stickyheader').offset().top; | |
$(window).scroll(function(){ | |
if( $(window).scrollTop() > stickyHeaderTop ) { | |
$('#stickyheader').css({position: 'fixed', top: '0px'}); | |
$('#stickyalias').css('display', 'block'); | |
$('#stickyheader').addClass('fix-top'); | |
} else { | |
$('#stickyheader').css({position: 'static', top: '0px'}); | |
$('#stickyalias').css('display', 'none'); | |
$('#stickyheader').removeClass('fix-top'); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style type="text/css"> | |
/* | |
Preloader | |
*/ | |
body.preloader-active { | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
top: 0; | |
left: 0; | |
z-index: 999999999; | |
overflow: hidden; | |
} | |
.preloader { | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
left: 0; | |
top: 0; | |
background: #fff; | |
z-index: 9999999999; | |
} | |
.preloader-spinner { | |
background: url(../img/preloader.gif) no-repeat center center; | |
width: 100px; | |
height: 100px; | |
left: 50%; | |
top: 50%; | |
margin-top: -50px; | |
margin-left: -50px; | |
position: absolute; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="preloader"> | |
<!--Background Image Add in preloader-spinner Class --> | |
<div class="preloader-spinner"></div> | |
</div> | |
<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script> | |
<script type="text/javascript"> | |
/*** | |
Preloader | |
***/ | |
$('body').addClass('preloader-active'); | |
$(window).on('load', function() { | |
$('.preloader').fadeOut(); | |
$('.preloader-spinner').delay(350).fadeOut('slow'); | |
$('body').removeClass('preloader-active'); | |
}); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scrollToTop($topClass){ | |
var top_0 = {scrollTop:0}; | |
var topClass = $($topClass); | |
topClass.on("click" , function(e){ | |
$("html,body").animate(top_0,1000); | |
return false; | |
}); | |
$(window).scroll(function(){ | |
if($(this).scrollTop() > 400) { | |
topClass.fadeIn(500); | |
} | |
else { | |
topClass.fadeOut(500); | |
} | |
}); | |
} | |
scrollToTop('.scrolltotop i'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.menu a[href*="#"]:not([href="#"])').on("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; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment