Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.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 鼠标移出橙色Div“;“当前高度”;他不在申请_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 鼠标移出橙色Div“;“当前高度”;他不在申请

Javascript 鼠标移出橙色Div“;“当前高度”;他不在申请,javascript,jquery,html,css,Javascript,Jquery,Html,Css,txt__mouse__hover : function(){ $(".itemMasTxt").hover(function () { currentHeight = $(this).height(); addHeight = 50; $(this).animate({ height:(curre

txt__mouse__hover : function(){
                $(".itemMasTxt").hover(function () {
                    currentHeight = $(this).height();
                    addHeight = 50;
                    $(this).animate({
                        height:(currentHeight + addHeight)
                    }, 200);


                }, function () {            
                    alert(" --" + currentHeight)    
                    $(this).animate({
                        height:(currentHeight)
                    }, 200);
                });

悬停时,iam计算div的当前高度,并通过jquery添加50px。 鼠标移出时,当前高度不适用

例如:

currentHeight=20px(此高度将是动态的)

AddHeight=50px

所以鼠标上方的div是70像素

当我鼠标离开时,电流高度应相同,即20px(此高度将是动态的)

JS代码:

txt__mouse__hover : function(){
                $(".itemMasTxt").hover(function () {
                    currentHeight = $(this).height();
                    addHeight = 50;
                    $(this).animate({
                        height:(currentHeight + addHeight)
                    }, 200);


                }, function () {            
                    alert(" --" + currentHeight)    
                    $(this).animate({
                        height:(currentHeight)
                    }, 200);
                });
JS

CSS

注意:对Div的填充导致了问题

JS

CSS

注意:对Div的填充导致了问题

检查

检查


它在我的浏览器中工作。它在我的浏览器中工作。请用小提琴举个例子。这样我就可以帮忙了,比如说,请用小提琴。这样我才能帮上忙
.itemMasTxtPara {
 padding:15px !important;   \\For saving time i made it important but u select the appropriate class and remove it
}

.itemMasTxt{
    padding:0px !important;  \\For saving time i made it important but u select the appropriate class and remove it
}
   var counter = 0;
   $(".itemMasTxt").hover(function () {
          if(innterText !== $(this)[0].innerText){
                counter = 0;
          }
          if(counter == 0){
               innerHeight = $(this).innerHeight();
               innerHeightAdd = $(this).innerHeight() + addHeight;
               innterText = $(this)[0].innerText;
          }
          counter++;
          $(this).stop().animate({
            height:(innerHeight + addHeight)
          }, 200);

    }, function () {
          $(this).stop().animate({
                height:(innerHeightAdd - addHeight)
          }, 200);
    });