$(function(){ $(".photo").fancybox({ padding: 0, mouseWheel: false, autoResize: true, autoCenter: true, openEffect: 'elastic', closeEffect: 'elastic', nextEffect: 'fade', prevEffect: 'fade', loop: false, helpers: { overlay: { locked: false } } }); $('.toggle_nav').on('click', function(){ if($('.horizontal_nav .nav_container').css('display') === 'none'){ $('.toggle_icon').attr('class', 'fa fa-times toggle_icon'); } else { $('.toggle_icon').attr('class', 'fa fa-bars toggle_icon'); } $('.horizontal_nav .nav_container').slideToggle(function(){ if($('.horizontal_nav .nav_container').css('display') === 'none'){ $('.horizontal_nav .nav_container').css('display', ''); } }); }); function change_image(){ current_header_image++; if(current_header_image >= header_images.length){ current_header_image = 0; } $(".horizontal_nav_background_transition").css("background-image", "url(" + header_images_path + header_images[current_header_image] + ")"); $(".horizontal_nav_background_transition").fadeIn(1000, function(){ $(".horizontal_nav_background").css("background-image", "url(" + header_images_path + header_images[current_header_image] + ")"); $(".horizontal_nav_background_transition").fadeOut(300); }); window.setTimeout(function(){change_image();}, interval); } $(".subnav_dropdown").change(function(){ var address = $(this).val(); address = address.split(":-"); if(address[1] == "blank") { var win = window.open(address[0], "_blank"); if(win) { win.focus(); } else { alert('Prosíme, povolte na této stránce vyskakovací okna.'); } } else { window.location.href = $(this).val(); } }); var header_images_path = "img/environment/"; var header_images = ["background_blue.jpg", "background_red.jpg", "background_yellow.jpg"]; var interval = 10000; var current_header_image = Math.floor(Math.random()*header_images.length); $(".horizontal_nav_background").css("background-image", "url(" + header_images_path + header_images[current_header_image] + ")"); window.setTimeout(function(){change_image();}, interval); var padding = ($(".article_image").width() / 100 * 42) - $(".article_header").height() + 24; if(padding > 0) { $(".article_image").css("paddingBottom", padding); } else { $(".article_image").css("paddingBottom", 0); } $(".article_image").css("minHeight", $(".article_header").height() + 24); $(window).resize(function(){ var padding = ($(".article_image").width() / 100 * 42) - $(".article_header").height() + 24; if(padding > 0) { $(".article_image").css("paddingBottom", padding); } else { $(".article_image").css("paddingBottom", 0); } $(".article_image").css("minHeight", $(".article_header").height() + 24); }); });