1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| var myClickEventHandler = function( e ){
var _is_animating_page = false;
if ($(this).hasClass('active') || _is_animating_page) return false;
if ($(this).hasClass('none')) {
document.location = $(this).attr('href');
return false;
}
_is_animating_page = true;
var div = '<div class="back-nav"></div>',
_width = $(this).outerWidth(),
_height = $(this).outerHeight(),
_top = $(this).offset().top,
_left = $(this).offset().left,
_rel = $(this).attr('rel'),
_width_page = $(window).width(),
_final_width = ($(this).index() > $('#header nav a.active').index()) ? _width_page : -_width_page;
$('#header nav a.active').removeClass('active');
$(this).addClass('active');
$('body').css({'overflow':'hidden'});
$('.page.active').css({'position':'absolute', 'width':'100%'}).animate({left:'-='+_final_width}, 500, 'easeInExpo', function() {
$('.page.active').css({'position':'relative', 'width': 'auto', 'left': 'auto'}).removeClass('active').hide();
$('#'+_rel).addClass('active').show().css({'position':'relative', 'width':'100%', 'left': _final_width}).animate({left:0}, 500, 'easeOutExpo', function() {
$('body').css({'overflow':'auto'});
_is_animating_page = false;
});
});
return false;
};
$( "[rel='page-accueil'], [rel='page-presentation'], [rel='page-photos'], [rel='page-plan'], [rel='page-contact']" ).on( "click", myClickEventHandler ); |
Partager