简体   繁体   English

当关闭屏幕菜单打开时,基金会可以与其他班级切换箭头

[英]Foundation make arrow switch with other class when off screen menu opens

So I've tried various javascript functions and toggle options to try and make the button switch from the right arrow to the left. 因此,我尝试了各种JavaScript函数和切换选项,以尝试使按钮从右箭头切换到左箭头。

.arrow-right {
    display: block;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 20px solid white;
  margin-left:10px;

}

.arrow-left {
    display: block;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 30px solid white;
transform: 

The javascript I used to do this was 我曾经用来做这件事的javascript是

$('#showhide').click(function() {
    $(this).toggleClass('arrow-left');
});

You can see the issue I'm running into in jsfiddle 您可以在jsfiddle中看到我遇到的问题

http://jsfiddle.net/bbarclay6/qbnc1jn7/7/ http://jsfiddle.net/bbarclay6/qbnc1jn7/7/

Any help is great and awesome :) 任何帮助都是很棒的:)

You don't need two classes. 您不需要两节课。 All you need to do is set the transform to 180deg and none depending on the action: 所有你需要做的是设置transform180degnone因行动:

//Rotate by 180 degrees when "showhide" is clicked i.e. when opening.
$('#showhide').click(function() {
  $(this).css("transform", "rotate(180deg)");
});

//Remove the transform when the "exit-off-canvas is clicked i.e. when closing. 
$('.exit-off-canvas').click(function() {
  $('#showhide').css("transform", "none");
});

Updated Fiddle 更新小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM