I am trying to create a tiled wall with a small menu for display: none some elements based on their class. In my CSS, I have CSS transitions that cause fadeIn and fadeOut not work. If I add time, the item will take so long to disappear, but there is no actual fading.
CSS:
.block:not(.noTransition), .block a img, #main_side p, #main_content, #menu_container{ -webkit-transition: all 1s ease-in-out; -moz-transition: all 1s ease-in-out; -o-transition: all 1s ease-in-out; -ms-transition: all 1s ease-in-out; transition: all 1s ease-in-out; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
JavaScript using jQuery:
$(document).ready(function(){ $('.button').not("#all").click(function(){ var theId = $(this).attr('id'); $('.block').not('.'+theId).addClass("noTransition"); $('.block').not('.'+theId).fadeOut('slow', function(){ $('.block').not('.'+theId).addClass("covered"); $('.block').not('.'+theId).removeClass("noTransition"); }); $('.'+theId).addClass("noTransition"); $('.'+theId).fadeIn('slow',function(){ $('.'+theId).removeClass("covered"); $('.'+theId).removeClass("noTransition"); }); getScreenSize(); }); $("#all").click(function(){ $('.block').removeClass("covered"); $('.block').show(); }); getScreenSize(); });
If I remove transitions from my CSS, then fades really work, but I also want the transition to be moved in order to move the elements after they are discovered / hidden.
source share