【发布时间】:2019-10-30 23:35:35
【问题描述】:
我有一个下拉菜单,希望在单击链接时旋转 V 形。目前这在codepen中有效。但是当我把它转移到我正在开发的网站上时,雪佛龙不会移动。测试和解决此问题的最佳方法是什么?
http://jsfiddle.net/ryannewell/u4om0Lac/16/
<!DOCTYPE html>
<html>
<head>
<title>Chevron</title>
<script defer src="https://use.fontawesome.com/releases/v5.9.0/js/all.js">
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<style>
.icon-rotates {
-moz-transition: all .2s linear;
-webkit-transition: all .2s linear;
transition: all .2s linear;
}
.icon-rotates.rotate {
-moz-transition: rotate(180deg);
-webkit-transition: rotate(180deg);
transition: rotate(180deg);
}
</head>
联系链接
<script>
$('.contact-link').click(function(){
if($(this).css("transform") == 'none') {
$(this).children().css('transform', 'rotate(180deg)');
} else {
$(this).children().css('transform', 'none');
}
});
$(".dropdown").on("hidden.bs.dropdown", function(){
$(this).find('.contact-link').children().css('transform', 'none');
});
</script>
</body>
</html>
我现在已经更新了。单击链接时,雪佛龙会旋转,但在我的解决方案中,我需要 date-toggle="collapse" 而不是 data-toggle="dropdown"。当我将其更改为折叠时,它停止工作
【问题讨论】:
标签: jquery twitter-bootstrap rotation icons dropdown