Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使jQuery搜索框从右向左调整,然后再调整我的搜索框?_Javascript_Jquery_Html_Search Box - Fatal编程技术网

Javascript 如何使jQuery搜索框从右向左调整,然后再调整我的搜索框?

Javascript 如何使jQuery搜索框从右向左调整,然后再调整我的搜索框?,javascript,jquery,html,search-box,Javascript,Jquery,Html,Search Box,我尝试的搜索框与页面右上角的搜索框大致相同: 我有这个,但它不能正常工作: $(文档).ready(函数(){ $(“#搜索”).mouseenter(函数(){ $(this.stop().animate({marginLeft:'-40',宽度:“181”},300) /*函数(){ $(this).animate({marginLeft:'0',width:'141'},300) });*/ }); $(“#搜索”).mouseleave(函数(){ 动画({marginLeft:'0'

我尝试的搜索框与页面右上角的搜索框大致相同:

我有这个,但它不能正常工作:

$(文档).ready(函数(){
$(“#搜索”).mouseenter(函数(){
$(this.stop().animate({marginLeft:'-40',宽度:“181”},300)
/*函数(){
$(this).animate({marginLeft:'0',width:'141'},300)
});*/
});
$(“#搜索”).mouseleave(函数(){
动画({marginLeft:'0',width:'141'},300);
});
});

文件

给出一个
浮动:右
文本对齐:右

$(文档).ready(函数(){
$(“#搜索”).css({
marginLeft:0,
宽度:141
});
$(“#搜索”).mouseenter(函数(){
$(this).stop().animate({
marginLeft:“-40”,
宽度:“181”
}, 300);
});
$(“#搜索”).mouseleave(函数(){
$(此)。设置动画({
marginLeft:0,
宽度:“141”
}, 300);
});
});
#搜索框{
文本对齐:右对齐;
}


很好,它的某些功能会更快恢复正常吗?当我离开老鼠。我想休假时不要耽搁mouse@HonzaSedloň您希望鼠标越快,鼠标越慢或延迟,是吗?当我把鼠标放出去时,大约需要1秒钟,然后它开始返回。我想消除这个延迟。@HonzaSedloň你想用纯CSS吗?天哪。我花了三天时间试图解决这个问题,多亏了你,我知道,这个问题是在Mozzila Firefox中出现的。在Microsoft Edge中,一切正常:(谢谢!已解决