S
Maybe I didn't fully understand your logic. But it seemed to me that you had a little fun with class and you were using the design for nothing. var box = $('.modal-dark, .modal');
So you chose two elements, a parent and a descendant, and worked with him as one: checking the class, adding and cleaning classes (one time for both elements). When I started this part of the order, i.e. separated the role of the parent and the descendant (the parent is just hiding and the descendant of the animation) - everything's up.$(document).on("click", ".project__discr--active", function () {
// $(' .modal-dark').removeClass('js-module-hide').show(600, 'swing');
module();
});
$(document).on("click", ".js-close-modal", function () {
// $(' .modal-dark').addClass('js-module-hide').hide(600, 'swing');
module();
});
var box = $('.modal-dark'),
modal = $('.modal');
function module () {
if (box.hasClass('js-module-hide')) {
box.removeClass('js-module-hide');
setTimeout(function () {
modal.removeClass('visuallyhidden');
}, 20);
} else {
modal.addClass('visuallyhidden');
modal.one('transitionend', function(e) {
box.addClass('js-module-hide');
});
}
};body {
overflow: hidden;
}
.project__discr--active {
display: inline-block;
background: rgba(0, 2, 45, 0.4);
cursor: pointer;
}
.visuallyhidden {
-webkit-transform: translate3d(100%, 0, 0);
-ms-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
opacity: 1;
}
.js-module-hide {
display: none;
opacity: 0;
}
.modal-dark {
background: rgba(0, 0, 0, 0.8);
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 9;
}
.modal.js-module-hide {
-webkit-transform: translate3d(0, 0, 0);
-ms-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.visuallyhidden {
-webkit-transform: translate3d(100%, 0, 0);
-ms-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
opacity: 1;
}
.modal {
height: 600px;
background: #fff;
position: absolute;
top: 0;
margin-top: 120px;
padding: 20px 0;
left: 0;
width: 100%;
z-index: 10;
-webkit-transition: -webkit-transform 0.3s ease-out;
transition: transform 0.3s ease-out;
will-change: top;
}
.base {
width: 100%;
margin: 0 auto;
position: relative;
}
.close-modal {
cursor: pointer;
position: absolute;
right: 0;
font-size: 30px;
border-radius: 100%;
-webkit-transition: all ease .3s;
transition: all ease .3s;
}
.project-gallerey {
float: left;
width: 60%;
position: relative;
}
.project-info {
float: left;
width: 32%;
margin-top: 50px;
margin-left: 35px;
padding-left: 15px;
position: relative;
z-index: 2;
background: rgba(255, 255, 255, 0.8);
}<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<div class="project__discr--active">Show me</div>
<div class="modal-dark js-module-hide">
<div class="modal visuallyhidden">
<div class="base">
<div class="close-modal js-close-modal">X</div>
<div class="project-gallerey">
<div class="pagination-gallerey"><span class="nav-pengetation on" rel="0"></span><span class="nav-pengetation" rel="1"></span><span class="nav-pengetation" rel="2"></span></div>
<div class="slider-gallerey">
<ul class="sliders-wrapper">
<li class="slider-image slider0"><img src="img/coming-soon.jpg" alt=""></li>
<li class="slider-image slider1"><img src="img/zhHFjKiZ52w.jpg" alt=""></li>
<li class="slider-image slider2"><img src="img/wCobhoyA1To.jpg" alt=""></li>
</ul>
</div>
</div>
<div class="project-info">
<div class="main-info">
<div class="top">
<div class="date">
<span class="ng-binding">2013</span>
<!-- ngIf: current.date.end != null -->
<span class="ng-binding ng-scope">- 2014</span>
<!-- end ngIf: current.date.end != null -->
</div>
<div class="type-site">desktop website</div>
</div>
<div class="sep"></div>
<div class="info-project__name">New Terracotta</div>
<div class="tags">
<!-- ngRepeat: tag in current.tags -->
<span class="tag-used-skills technologies-in-project__technology">Javascript</span>
<!-- end ngRepeat: tag in current.tags -->
<span class="tag-used-skills technologies-in-project__technology">HTML5 & CSS3</span>
<!-- end ngRepeat: tag in current.tags -->
<span class="tag-used-skills technologies-in-project__technology">jQUery</span>
<!-- end ngRepeat: tag in current.tags -->
</div>
<ul class="topics">
<!-- ngRepeat: topic in current.topics -->
<li class="project__skills skills-style">- HTML5 & CSS3</li>
<!-- end ngRepeat: topic in current.topics -->
<li class="project__skills skills-style">- jQuery</li>
<!-- end ngRepeat: topic in current.topics -->
<li class="project__skills skills-style">- oo javascript</li>
<!-- end ngRepeat: topic in current.topics -->
<li class="project__skills skills-style">- SEO optimization</li>
<!-- end ngRepeat: topic in current.topics -->
<li class="project__skills skills-style">- cross browser compatibility</li>
<!-- end ngRepeat: topic in current.topics -->
<li class="project__skills skills-style">- project management</li>
<!-- end ngRepeat: topic in current.topics -->
<li class="project__skills skills-style">- DotNetNuke skinning</li>
<!-- end ngRepeat: topic in current.topics -->
</ul>
</div>
</div>
</div>
</div>
</div>