我有一个链接,当我结束它时,我更改了一个变量值,因此将使用ng-if显示<p>
标记。代码如下:
<div class="position text-center" ng-mouseover="social=1" ng-mouseleave="social=-1">
<a href="#6thPage">something</a>
</div>
ng-if部分如下
<div class="col-md-12 center-block text-center grey" ng-if="social == 1">
<p class="fadeInDown animated">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptates quibusdam ullam tenetur facilis cupiditate iusto laudantium, ex nobis.</p>
</div>
当我删除fadeInDown和动画类时,它可以正常工作。但是当我在上面使用它时,当我将鼠标移到链接上时会有一点闪烁。
答案 0 :(得分:0)
我使用ng-if
遇到了类似的问题。我用ng-class
代替了它。对于您的问题,我建议采用以下解决方案:
display: none
:<强> HTML:强>
<div class="col-md-12 center-block text-center grey hide-element">
<p class="fadeInDown animated">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptates quibusdam ullam tenetur facilis cupiditate iusto laudantium, ex nobis.</p>
</div>
<强> CSS:强>
.hide-element {
display: none;
}
<强> CSS:强>
.show-element{
display: block;
}
ng-class
以切换可见性:<强> HTML:强>
<div class="col-md-12 center-block text-center grey" ng-class="{'show-element': social == 1, 'hide-element': social != 1}">
<p class="fadeInDown animated">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptates quibusdam ullam tenetur facilis cupiditate iusto laudantium, ex nobis.</p>
</div>
另外,我假设您使用的是animate.css?