[英]jQuery toggle arrow down 'ontoggle'
嗨,我有以下內容: FIDDLE
本質上是手風琴切換菜單。 我要嘗試的是一旦菜單已打開打開,就將箭頭從正確的位置旋轉到向下的位置。 菜單關閉后,我希望箭頭向右旋轉。 我嘗試通過找到CSS和
transform: rotate(-90deg)
但是,箭頭的位置不會改變。 思考? 這是<script>
//Dekstop Content
$('.content').each(function () {
var $accordian = $(this);
$accordian.find('.view').on('click', function () {
$accordian.find('.content-body').slideUp();
$accordian.find('span').css("transform", 'rotate(0deg);');
if (!$(this).next().is(':visible')) {
$(this).next().slideDown();
$(this).find('span').css({"transform": 'rotate(90deg);'})
}
});
});
.css
應該如下所示: .css('Property-Name','Value')
試試這個代碼:
//Dekstop Content
$('#content').each(function () {
var $accordian = $(this);
$accordian.find('.view').on('click', function () {
$accordian.find('.content-body').slideUp();
$accordian.find('span').css('transform','rotate(0deg)'); // Changed
if (!$(this).next().is(':visible')) {
$(this).next().slideDown();
$(this).find('span').css('transform', 'rotate(90deg)'); // Changed
}
});
});
維也納的問候
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.