Asalii
شنبه 21 تیر 1393, 12:40 عصر
سلام یه سوال دارم اینه که من کد زیر رو نوشتم ولی فقط یک بار در هر لود کار میکنه یعنی یک بار اسکرول دون میشه دکمه ی اسکرول آپم ظاهر میشه یعنی کاملا کار میکنه اما فقط ۱ بار مشکل از چیه لطفا کمک کنید
$(window).scroll(function() {
if ($(".navbar").offset().top > 50) {
$(".navbar-fixed-top").addClass("top-nav-collapse");
} else {
$(".navbar-fixed-top").removeClass("top-nav-collapse");
}
$(window).scroll(function() {
// 100 = The point you would like to fade the nav in.
if ($(window).scrollTop() > 100 ){
$(".navbar-brand").addClass('show');
} else {
$('.navbar-brand').removeClass('show');
};
});
$('.navbar-brand').on('click', function(e){
e.preventDefault()
$('html, body').animate({
scrollTop : $(this.hash).offset().top
}, 1500);
});
$('.scroll').on('click', function(e){
e.preventDefault()
$('html, body').animate({
scrollTop : $(this.hash).offset().top
}, 1500);
});
$(window).scroll(function() {
if ($(".navbar").offset().top > 50) {
$(".navbar-fixed-top").addClass("top-nav-collapse");
} else {
$(".navbar-fixed-top").removeClass("top-nav-collapse");
}
$(window).scroll(function() {
// 100 = The point you would like to fade the nav in.
if ($(window).scrollTop() > 100 ){
$(".navbar-brand").addClass('show');
} else {
$('.navbar-brand').removeClass('show');
};
});
$('.navbar-brand').on('click', function(e){
e.preventDefault()
$('html, body').animate({
scrollTop : $(this.hash).offset().top
}, 1500);
});
$('.scroll').on('click', function(e){
e.preventDefault()
$('html, body').animate({
scrollTop : $(this.hash).offset().top
}, 1500);
});