// responsive functions var screenWidth = $(window).width(); var screenHeight = $(window).height(); var infoFromTop = 120; var galleryCurrent = 0; // gallery var galleryArr = Array(); var popisyArr = Array(); var titulkyArr = Array(); galleryArr[0] = 'gallery/knihy/32/41a875a7.jpg'; galleryArr[1] = 'gallery/knihy/32/f4af6306.jpg'; galleryArr[2] = 'gallery/knihy/32/96138785.jpg'; function callNext() { ++galleryCurrent; if (galleryCurrent>=galleryArr.length) { galleryCurrent = 0; } $("#detail").load(function() { // buttons(); }).attr('src', galleryArr[galleryCurrent]); var info = "

" + titulkyArr[galleryCurrent] + "

" + popisyArr[galleryCurrent] + "
"; $("#infoClick").html(info); /* casovac = setTimeout("callNext()", 5000); */ $('.close').click(function(e) { e.preventDefault(); $('#infoClick').css("display", "none"); /* casovac = setTimeout("callNext()", 5000); */ }); } function getWidth() { screenWidth = $(window).width(); // alert(screenWidth); screenHeight = $(window).height(); if(screenWidth<768) { screenWidth = 768; } /* if(screenWidth>1500) { screenWidth = 1500; } */ /* full screen */ if ($(document).is('.homepage') || $(document).is('.novinky')) { $('#page').css("height", screenHeight+"px"); } else { $('#page').css("height", screenHeight-150+"px"); $('#header').css("position", "relative"); } if (screenHeight>500) { infoFromTop = (screenHeight/2)-150; } else { infoFromTop = 150; } $('#info').css("top", (infoFromTop+120-30)+"px"); $('#info-detail').css("top", infoFromTop+"px"); $('#books-info').css("top", (infoFromTop+120-30)+"px"); $('#ikony').css("top", (infoFromTop+120)+"px"); $('#infoClick').css("top", (infoFromTop-30+120)+"px"); /* list */ $('#infoClick').css("width", (screenWidth/2.4)-80+"px"); /* $('.col-left div').css("height", screenWidth/6+"px"); $('.col-med div').css("height", screenWidth/6+"px"); $('.col-right div').css("height", screenWidth/6+"px"); */ $('.inf').css("height", $('#p1').width()/1.5+"px"); $('#detail').css("height", "100%"); $('.innerP').css("width", $('#p1').width()-10+"px"); $('.innerP').css("height", $('#p1').height()+"px"); $('.innerP a').css("width", $('.innerP').width()); $('.innerP a').css("height", $('.innerP').height()); // alert($('#detail').width()); } $(document).ready(function() { $('#info .close').click(function(e) { e.preventDefault(); $('#info').css("display", "none"); }); /* $('img').click(function(e) { curElem = e.target.id; curElem = parseInt(curElem.substring(1)); $('innerP').css("background-color", "pink"); }); $('.inf').mouseout(function(e) { curElem = e.target.id; curElem = parseInt(curElem.substring(1)); $('innerP').css("background-color", "blue"); }); */ $('#info-detail .close').click(function(e) { e.preventDefault(); $('#info-detail').css("display", "none"); }); $('.close').click(function(e) { e.preventDefault(); $('#infoClick').css("display", "none"); }); $('.continue').click(function(e) { e.preventDefault(); $('#info-detail').css("display", "block"); }); $('.more').click(function(e) { e.preventDefault(); if($('#infoClick').css("display") != "block") { $('#infoClick').css("display", "block"); } else { $('#infoClick').css("display", "none"); } }); $('.next').click(function(e) { e.preventDefault(); ++galleryCurrent; if (galleryCurrent>=galleryArr.length) { galleryCurrent = 0; } $("#detail").load(function() { // buttons(); }).attr('src', galleryArr[galleryCurrent]); }); $('.prev').click(function(e) { //TESTERJE alert("WT"); e.preventDefault(); --galleryCurrent; if (galleryCurrent<0) { galleryCurrent = galleryArr.length - 1; } $("#detail").load(function() { // buttons(); }).attr('src', galleryArr[galleryCurrent]); }); /* $("#detail").load(function() { // buttons(); }).attr('src', galleryArr[galleryCurrent]); }); */ $('#books a').mouseover(function(e) { curElem = e.target.id; curElem = parseInt(curElem.substring(1)); $('#books-info div').css("display", "none"); $('#books-info #i'+curElem).css("display", "block"); }); $('#p1').load(function() { $('.innerP').css("width", $('#p1').width()-10+"px"); $('.innerP').css("height", $('#p1').height()+"px"); $('.innerP a').css("width", $('.innerP').width()); $('.innerP a').css("height", $('.innerP').height()); }); $('img').mouseover(function(e) { $('.innerP').css("visibility", "hidden"); $('img').css("opacity", "1"); curElem = e.target.id; curElem = parseInt(curElem.substring(1)); //alert(curElem); $('#p'+curElem).css("opacity", "0.3"); $('#d'+curElem).css("visibility", "visible"); }); $('.innerP').mouseout(function(e) { curElem = e.target.id; curElem = parseInt(curElem.substring(1)); // alert(curElem); $('#p'+curElem).css("opacity", "1"); $('#d'+curElem).css("visibility", "hidden"); }); // on resize var delay = (function(){ var timer = 0; return function(callback, ms){ clearTimeout (timer); timer = setTimeout(callback, ms); }; })(); $(window).resize(function() { delay(function(){ getWidth(); }, 200); }); // on load center .box getWidth(); /* */ /* if (typeof(galleryArr) != "undefined" && variable !== null) { $("#detail").load(function() { buttons(); }).attr('src', galleryArr[0]); } */ });