使箭头向后切换(0deg);x〃;单击关闭图标
Have arrow toggle back (0deg) when "x" close icon is clicked
我一直在制作手风琴,它接近我需要的样子。然而,在单击关闭"x"图标后,我似乎无法让箭头旋转回0度。开关闭合,但箭头保持在向下位置。
小提琴
$('#main').each(function () {
var $accordian = $(this);
$accordian.find('.view-m').on('click', function () {
$accordian.find('.mobile-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)');
$(this).next().slideDown();
$accordian.find('.close').click(function () {
$(this).parent().slideUp(500);
$(this).find('span').css('transform', 'rotate(0deg)');
});
}
});
});
问题就在这一行:
$(this).find('span').css('transform', 'rotate(0deg)');
您正在搜索X按钮内部的箭头。你需要向上搜索2个元素:
固定Fiddle
$('#main').each(function () {
var $accordian = $(this);
$accordian.find('.view-m').on('click', function () {
$accordian.find('.mobile-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)');
$(this).next().slideDown();
$accordian.find('.close').click(function () {
$(this).parent().slideUp(500);
$(this).parent().parent().find('span').css('transform', 'rotate(0deg)');
});
}
});
});
更改此行
$(this).find('span').css('transform', 'rotate(0deg)');
带有
$(this).parent().prev('.view-m').find('span').css('transform', 'rotate(0deg)');
演示
相关文章:
- 单击更改图标并通过javascript添加一个css类
- 使用Angular单击时更改特定图示符图标的颜色
- 通过单击同一图标使菜单出现和消失
- 如何制作Yii框架的linkHtmlOptions's的CGridView显示为图像图标,单击时会触发javas
- 单击时切换上下图示符图标的问题
- 单击扩展图标时打开popup.html
- Jdewit Timepicker 在文本和图标单击上显示小部件
- 单击图标后编辑信息
- 如何在单击图标时渲染图标并调用函数
- 单击图标时切换颜色
- 根据单击图标更改 IMG SCR
- 如何自动关闭并单击图标日期选择器引导程序
- j查询按钮.单击图标时删除
- 谷歌浏览器扩展程序 - 单击图标可调用函数
- javascript 可单击图标而不是弹出窗口
- 修改日期选择插件以在单击图标时弹出日历
- 如果在 HTML/JS 中单击图标,则显示弹出窗口
- 单击图标时禁用扩展
- 单击图标时更改其字体
- 无法在选择框中单击图标三角形