Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.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 css底部的更改&;再来一次_Javascript_Jquery - Fatal编程技术网

Javascript jquery css底部的更改&;再来一次

Javascript jquery css底部的更改&;再来一次,javascript,jquery,Javascript,Jquery,是不是出了什么问题还是jquery的bug? 例如,我们有这样的代码,在第三次单击该层时,不要再次更改为底部 <style type="text/css"> #menu1 { width:100%; height:32px; overflow:hidden; background:#ff0033; position:fixed; left:0px; cursor:pointer; bottom:174px; } #content1 {

是不是出了什么问题还是jquery的bug?

例如,我们有这样的代码,在第三次单击该层时,不要再次更改为底部

<style type="text/css">
#menu1 {
  width:100%; 
  height:32px; 
  overflow:hidden; 
  background:#ff0033; 
  position:fixed; 
  left:0px; 
  cursor:pointer; 
  bottom:174px;
}
#content1 {
  position:fixed; 
  width:100%; 
  left:0; 
  overflow:auto; 
  background:blue; 
  height:200px;  
  bottom:300px;
}
</style>

#菜单1{
宽度:100%;
高度:32px;
溢出:隐藏;
背景:#ff0033;
位置:固定;
左:0px;
光标:指针;
底部:174px;
}
#内容1{
位置:固定;
宽度:100%;
左:0;
溢出:自动;
背景:蓝色;
高度:200px;
底部:300px;
}

$(函数(){
var=1=0;
$(“#菜单1”)。单击(函数(){
如果(单击1==0){
$(“#content1”).css({底部:“250px”,显示:“block”,位置:“fixed”});
点击1=1;
}否则{
$(“#content1”).css({top:“100px”,“display:“block”,display:“block”,position:“fixed”});
点击1=0;
}
});
});

如果您同时设置了
top
bottom
,那么它们要么都被应用(并计算了高度),要么如果设置了高度,则只应用
top
。因此,您需要擦拭不使用的:

{ bottom: 250, top: 'auto' }
{ top: 100, bottom: 'auto' }

如果同时设置了
top
bottom
,则会出现这样的问题,即它们要么都被应用(并计算了高度),要么如果设置了高度,则只应用
top
。因此,您需要擦拭不使用的:

{ bottom: 250, top: 'auto' }
{ top: 100, bottom: 'auto' }