-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed bug with transition on firefox
- Loading branch information
1 parent
6ed2c8c
commit b282aab
Showing
1 changed file
with
22 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,38 @@ | ||
jQuery(document).ready(function($){ | ||
var is_firefox = navigator.userAgent.indexOf('Firefox') > -1; | ||
|
||
//open team-member bio | ||
$('#cd-team').find('ul a').on('click', function(event){ | ||
event.preventDefault(); | ||
var selected_member = $(this).data('type'); | ||
$('main').addClass('slide-out'); | ||
$('.cd-member-bio.'+selected_member+'').addClass('slide-in'); | ||
$('.cd-member-bio-close').addClass('is-visible'); | ||
$('body').addClass('overflow-hidden'); | ||
|
||
// firefox transitions break when parent overflow is changed, so we need to wait for the end of the trasition to give the body an overflow hidden | ||
if( is_firefox ) { | ||
$('main').addClass('slide-out').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){ | ||
$('body').addClass('overflow-hidden'); | ||
}); | ||
} else { | ||
$('main').addClass('slide-out'); | ||
$('body').addClass('overflow-hidden'); | ||
} | ||
|
||
}); | ||
|
||
//close team-member bio | ||
$(document).on('click', '.cd-overlay, .cd-member-bio-close', function(event){ | ||
event.preventDefault(); | ||
$('main').removeClass('slide-out'); | ||
$('.cd-member-bio').removeClass('slide-in'); | ||
$('.cd-member-bio-close').removeClass('is-visible'); | ||
$('body').removeClass('overflow-hidden'); | ||
|
||
if( is_firefox ) { | ||
$('main').removeClass('slide-out').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){ | ||
$('body').removeClass('overflow-hidden'); | ||
}); | ||
} else { | ||
$('main').removeClass('slide-out'); | ||
$('body').removeClass('overflow-hidden'); | ||
} | ||
}); | ||
}); |