Есть Landing, на котором установлен фрэймворк FullPage.js.
Возникла проблема в том, что некоторые скрипты работают только после перезагрузки страницы. Что нужно сделать?
var ready;
ready = function() {
$(".photo_content_galery img:nth-child(1)").click(function(){
$(".photo_content_popup").css("pointer-events","auto").css("opacity","1");
setTimeout(function(){
$(".photo_content_popup_block").addClass("animated zoomIn");
$(".photo_content_popup_block img:nth-child(1)").addClass("animated zoomIn faster").css("display","block");
}, 200);
});
$(".photo_content_galery img:nth-child(2)").click(function(){
$(".photo_content_popup").css("pointer-events","auto").css("opacity","1");
setTimeout(function(){
$(".photo_content_popup_block").addClass("animated zoomIn");
$(".photo_content_popup_block img:nth-child(2)").addClass("animated zoomIn faster").css("display","block");
}, 200);
});
$(".photo_content_galery img:nth-child(3)").click(function(){
$(".photo_content_popup").css("pointer-events","auto").css("opacity","1");
setTimeout(function(){
$(".photo_content_popup_block").addClass("animated zoomIn");
$(".photo_content_popup_block img:nth-child(3)").addClass("animated zoomIn faster").css("display","block");
}, 200);
});
$(".photo_content_galery img:nth-child(4)").click(function(){
$(".photo_content_popup").css("pointer-events","auto").css("opacity","1");
setTimeout(function(){
$(".photo_content_popup_block").addClass("animated zoomIn");
$(".photo_content_popup_block img:nth-child(4)").addClass("animated zoomIn faster").css("display","block");
}, 200);
});
$(".photo_content_galery img:nth-child(5)").click(function(){
$(".photo_content_popup").css("pointer-events","auto").css("opacity","1");
setTimeout(function(){
$(".photo_content_popup_block").addClass("animated zoomIn");
$(".photo_content_popup_block img:nth-child(5)").addClass("animated zoomIn faster").css("display","block");
}, 200);
});
$(".photo_content_galery img:nth-child(6)").click(function(){
$(".photo_content_popup").css("pointer-events","auto").css("opacity","1");
setTimeout(function(){
$(".photo_content_popup_block").addClass("animated zoomIn");
$(".photo_content_popup_block img:nth-child(6)").addClass("animated zoomIn faster").css("display","block");
}, 200);
});
$(".photo_content_popup_block img").click(function(){
$(".photo_content_popup_block img").removeClass("animated zoomIn faster").addClass("animated zoomOut faster").css("display","none");
setTimeout(function(){
$(".photo_content_popup").css("pointer-events","none").css("opacity","0");
}, 200);
$(".photo_content_popup_block img, .photo_content_popup, .photo_content_pupop_block").removeClass("animated zoomIn zoomOut fadeIn fadeOut faster");
});
$(".photo_content_popup .close_button img").click(function(){
$(".photo_content_popup_block img").removeClass("animated zoomIn faster").addClass("animated zoomOut faster").css("display","none");
setTimeout(function(){
$(".photo_content_popup").css("pointer-events","none").css("opacity","0");
}, 200);
$(".photo_content_popup_block img, .photo_content_popup, .photo_content_pupop_block").removeClass("animated zoomIn zoomOut fadeIn fadeOut faster");
});
$(".nav-arrow img").click(function(){
fullpage_api.moveSectionDown();
});
$(".button-site, .header_head_submit_button, .header_content_left_button").click(function(){
fullpage_api.moveTo('sixthPage', 0);
});
$('#fullpage').fullpage({
navigation: true,
scrollingSpeed: 500,
responsiveWidth: 900,
anchors:['firstPage', 'secondPage', 'thirdPage', 'fourthPage', 'fifthPage', 'sixthPage'],
afterLoad: function(origin, destination, direction){
if(destination.index == 1){
$(".product_content_img").addClass("animated fadeInDown faster");
$(".product_content_desc").addClass("animated fadeInUp faster");
setTimeout(function() {
$(".product_content_button").addClass("animated fadeInUp faster");
}, 300);
}
if(destination.index == 2 || destination.index == 4){
$(".advantages_content_title").addClass("animated fadeInUp faster");
setTimeout(function() {
$(".advantages_content_desc").addClass("animated fadeInUp faster");
setTimeout(function() {
$(".advantages_content_advant").addClass("animated fadeInUp faster");
setTimeout(function() {
$(".advantages_content_requirement").addClass("animated fadeInUp faster");
setTimeout(function() {
$(".advantages_content_button").addClass("animated fadeInUp faster");
}, 300);
}, 300);
}, 300);
}, 300);
}
if(destination.index == 3){
$(".product_content_img").addClass("animated fadeInDown faster");
$(".product_content_desc").addClass("animated fadeInUp faster");
setTimeout(function() {
$(".product_content_button").addClass("animated fadeInUp faster");
}, 300);
$(".photo_content_galery img:nth-child(1), .photo_content_galery img:nth-child(2), .photo_content_galery img:nth-child(3)").addClass("animated fadeInUp faster");
$(".photo_content_title").addClass("animated fadeInDown faster");
setTimeout(function() {
$(".photo_content_galery img:nth-child(4), .photo_content_galery img:nth-child(5), .photo_content_galery img:nth-child(6)").addClass("animated fadeInUp faster");
setTimeout(function() {
$(".photo_content_button").addClass("animated fadeInUp faster");
}, 200);
}, 200);
}
if(origin.anchor == "thirdPage"){
$(".photo_content_galery img:nth-child(1), .photo_content_galery img:nth-child(2), .photo_content_galery img:nth-child(3)").addClass("animated fadeInUp faster");
$(".photo_content_title").addClass("animated fadeInDown faster");
setTimeout(function() {
$(".photo_content_galery img:nth-child(4), .photo_content_galery img:nth-child(5), .photo_content_galery img:nth-child(6)").addClass("animated fadeInUp faster");
setTimeout(function() {
$(".photo_content_button").addClass("animated fadeInUp faster");
}, 200);
}, 200);
}
if(origin.anchor == "fourthPage" || origin.anchor == "sixthPage"){
$(".about_content .who").addClass("animated fadeInDown faster");
setTimeout(function(){
$(".about_content p").addClass("animated fadeInDown faster");
setTimeout(function(){
$(".about_content h3").addClass("animated fadeInDown faster");
setTimeout(function(){
$(".about_content .advantage:nth-child(1)").addClass("animated fadeInUp faster");
}, 100);
setTimeout(function(){
$(".about_content .advantage:nth-child(2)").addClass("animated fadeInUp faster");
}, 100);
setTimeout(function(){
$(".about_content_button").addClass("animated fadeInUp faster");
}, 200);
}, 200);
}, 200);
}
if( $(".contacts").hasClass("active") ){
$(".nav-arrow").css("display","none");
} else {
$(".nav-arrow").css("display","flex");
}
},
onLeave: function(origin, destination, direction){
setTimeout(function() {
$(".product_content_img").removeClass("animated fadeInDown faster");
$(".product_content_desc").removeClass("animated fadeInUp faster");
$(".product_content_button").removeClass("animated fadeInUp faster");
$(".advantages_content_title, .advantages_content_desc, .advantages_content_advant, .advantages_content_requirement, .advantages_content_button").removeClass("animated fadeInUp faster");
$(".photo_content_galery img").removeClass("animated fadeInDown fadeInUp faster");
$(".photo_content_title").removeClass("animated fadeInDown faster");
$(".photo_content_button").removeClass("animated fadeInUp faster");
$(".about_content .who, .about_content p, .about_content h3, .about_content .advantage, .about_content_button").removeClass("animated fadeInDown fadeInUp faster").css("opacity","0");
}, 300)
}
});
};
$(document).ready(ready);
$(document).on('page:load', ready);