Answer the question
In order to leave comments, you need to log in
Replacing search with a basket when scrolling?
There is a menu fixed when scrolling the page. The block also has a search. When scrolling down, the search is replaced with a basket. If you scroll back to the top, the search appears again, but it no longer works! How can this be fixed? Here is a script with fixing and replacing elements
$(document).ready(function(){
var $menu = $(".vnesh-plashka");
var $cart = $("#cart"),
$search = $("#search");
$(window).scroll(function(){
if ( $(this).scrollTop() > 140 && $menu.hasClass("default") ){
$menu.fadeOut('fast',function(){
$(this).removeClass("default")
.addClass("fixed")
.fadeIn('slow');
});
$("#search").replaceWith($cart);
} else if($(this).scrollTop() <= 140 && $menu.hasClass("fixed")) {
$menu.removeClass("fixed").addClass("default");
$(".vnesh-plashka #cart").replaceWith($search);
$(".cartt").append($cart);
}
});//scroll
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question