这是一个切换,显示和隐藏多重切换的div。我现在设置为在div打开时也切换向下箭头,但是一旦div关闭,箭头仍然停留在向下位置,我希望它返回到右侧位置。
$(this).find('span').css('transform', 'rotate(0deg)');
完整剧本
$(document).ready(function() {
// Toggles 1st Hidden Desktop Div
$(".dtc-s").click(function() {
$(".dtc-h").slideToggle(500);
$(".dtc-two-h, dtc-three-h").hide(500);
$(this).find('span').css('transform', 'rotate(90deg)');
});
// Toggles 2nd Hidden Desktop Div
$(".dtc-two-s").click(function() {
$(".dtc-two-h").slideToggle(500);
$(".dtc-three-h, .dtc-h").hide(500);
$(this).find('span').css('transform', 'rotate(90deg)');
});
// Toggles 3rd Hidden Desktop Div
$(".dtc-three-s").click(function() {
$(".dtc-three-h").slideToggle(500);
$(".dtc-two-h, .dtc-h").hide(500);
$(this).find('span').css('transform', 'rotate(90deg)');
});
// #1
if ($('.dtc-one').is(':visible')) $(this).next().slideDown();
$(this).find('span').css('transform', 'rotate(0deg)');
// #2
if ($('.dtc-two').is(':visible')) $(this).next().slideDown();
$(this).find('span').css('transform', 'rotate(0deg)');
// #3
if ($('.dtc-three').is(':visible')) $(this).next().slideDown();
$(this).find('span').css('transform', 'rotate(0deg)');
});
请HTML代码 – AvrilAlejandro 2014-09-29 16:37:14