[英]ng-hide not working properly
I am trying to code a solution using ng-hide and and ng-show in angularjs. 我正在尝试在angularjs中使用ng-hide和ng-show编码解决方案。 On clicking on the ng-hide, it delays before hiding to show the view panel.
在单击ng-hide时,它会在隐藏以显示视图面板之前延迟。 Please what could be wrong.
请出什么问题。 Here is a plunker I have made.
这是我做的一个矮人。
http://plnkr.co/edit/IiSwQ1cijiypdwIXV6K7?p=preview http://plnkr.co/edit/IiSwQ1cijiypdwIXV6K7?p=preview
This is the code view: 这是代码视图:
<div ng-app="myApp">
<h1>Ng-show & ng-hide</h1>
<p class="description">Click on the "show"-link to see the content.</p>
<a href="" ng-click="showme=true">Show</a>
<button ng-click="showme=false">Hide</button>
<div class="wrapper">
<p ng-hide="showme">It will appear here!</p>
<h2 ng-show="showme">This is mah content, yo!</h2>
</div>
</div>
Its because you have added animation effect on that, which has 2s transition
delayed while hiding h2
tag. 这是因为您为此添加了动画效果,在隐藏
h2
标签的同时延迟了2s的transition
。 Reducing that transition will improve its speed. 减少过渡将提高其速度。 For getting rid of delay while hiding element you should remove
transition
property of css
CSS 为了摆脱隐藏元素时的延迟,您应该删除
css
CSS的 transition
属性
h2 {
color: #2980b9;
margin-bottom: 9px;
margin-top: 0;
font-size: 20px;
background-color: white;
/*width: 100px;*/
text-align: center;
padding: 16px;
z-index: 15;
border-radius: 4px;
/*transition: all 0.1s ease-out;*/ //<-- reduced it to 0.1 sec will
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.