所以我有导航栏,上面有一个搜索栏。当您要搜索时,它会出现。当你完成后,它会滑回来。问题是,我无法让它向上滑动,我只能让它向下滑动。这是我的代码
$(document).ready(function(){
$(".icon-search").click(function(){
$(".slip").toggleClass("slip-open");
$("#FORM_1").removeAttr("style");
});
还有一个使用 CSS 和标记的演示 http://jsfiddle.net/FjwPZ/2/
您会看到搜索栏向下滑动,但不会向上滑动。任何帮助都会很棒。
最佳答案
使用 toggle()
而不是 removeAttr
Toggles each of the set of matched elements. If they are shown, toggle makes them hidden. If they are hidden, toggle makes them shown.
试试这个:
$(document).ready(function(){
$(".icon-search").click(function(){
$(".slip").toggleClass("slip-open");
$("#FORM_1").toggle();
});
关于javascript - 无法让搜索栏返回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24725036/