mercredi 7 janvier 2015

Is there a way to ignore certain transitionend events based on css property?


Vote count:

0




Is there a way to ignore certain transitionend events based on css property? For example in the following code, the height transition ends much sooner than the left transition. Is there a way to ignore the height transition to get the last transitionend event?


html:



<div id="testButton"></div>

<div id="wrapper" class="wrapper">
<div id="menu" class="menu">
<div id="menu-sets" class="menu-sets">

</div>
</div>
</div>


css:



#testButton {
position: absolute;
top: 0;
left: 200px;
width: 100px;
height: 100px;

background-color: #00ff00;
}
.menu-sets {
position: absolute;
visibility: hidden;
overflow: hidden;
top: 0;
left: -50px;
z-index: 100;
width: 100px;
height: 100px;

background-color: #ff0000;

transition: left 3.3s ease-out, height 0.2s ease-out;
}
.show-menu-1 .menu-sets {
visibility: visible;
left: 0px;
height: 200px;
}


js:



$(document).ready(function () {
$("#testButton").click(
function () {
$('#wrapper').addClass('show-menu-1'); // show menu
}
);

$('#menu-sets').one('transitionend', function() {
alert("event done");
});
});


jsfiddle example:


http://ift.tt/1FqoYjc



asked 1 min ago







Is there a way to ignore certain transitionend events based on css property?

Aucun commentaire:

Enregistrer un commentaire