function eResize() { $(".centerize").each(function () { $(this).css("padding-top", (($(this).parent().height()/2)-($(this).height()/2))+"px"); }); $(".gallery").each(function () { var perrow = Math.round($(window).width()/400); if (perrow < 1) {perrow = 1;} var colwidth = Math.floor($(window).width()/perrow); if (($(this).find("a").length*colwidth) < $(window).width()) {colwidth = $(window).width()/$(this).find("a").length;} $(this).find("a").css("width", colwidth+"px"); $(this).find(".gallery-container").css("width", (($(this).find("a").width()+10)*$(this).find("a").length)+"px"); $(this).find(".gallery-container").css("left", "0px"); $(this).attr("gallery-index", 0); }); } function eToggleMenu() { $("nav").toggleClass("open"); } function eShiftGallery(element, direction) { var index; if (element.attr("gallery-index") == undefined) { index = 0; } else { index = parseInt(element.attr("gallery-index")); } index += direction; var perrow = Math.round($(window).width()/400); if (perrow < 1) {perrow = 1;} if (index >= 0 && index-perrow < element.find("a").length-1) { element.attr("gallery-index", index); element.find(".gallery-container").animate({"left" : -(index*(element.find("a").width()+5))+"px"}, 500, "easeInOutCubic"); if (index < 1) {element.find(".arrow-previous").css("opacity", "0.2");} else {element.find(".arrow-previous").css("opacity", "1");} if (index+perrow >= element.find("a").length) {element.find(".arrow-next").css("opacity", "0.2");} else {element.find(".arrow-next").css("opacity", "1");} } } function eChangePage(id) { $(".players a").removeClass("selected"); $("#page-"+id).addClass("selected"); $.ajax({ type:"GET", data: { "eAction" : "eGetPage", "ePageID" : id }, url:"e.output.php", success: function(data) { $("#page-content").fadeOut(500, function () { $("#page-content").html(data).fadeIn(500); }); } }); } $(document).ready(function () { if (/Android|webOS|iPhone|iPod|iPad|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { FastClick.attach(document.body); $(".gallery").each(function () { var gallery = $(this); $(this).on("swipeleft",function() { eShiftGallery(gallery, +1); }); $(this).on("swiperight",function() { eShiftGallery(gallery, -1); }); $(this).find(".arrow-next").click(function() { eShiftGallery(gallery, +1); }); $(this).find(".arrow-previous").click(function() { eShiftGallery(gallery, -1); }); }); } else { $(".gallery").each(function () { $(this).find(".arrow-previous, .arrow-next").hide(); $(this).mousemove(function (event) { var perrow = Math.round($(window).width()/400); if (perrow < 1) {perrow = 1;} var colwidth = Math.floor($(window).width()/perrow); if (($(this).find("a").length*colwidth) > $(window).width()) { var percent = event.pageX/$(window).width(); var maximum = ($(this).find(".gallery-container").width()-($(this).find("a").length*5))-$(window).width(); var offset = -maximum*percent; $(this).find(".gallery-container").attr("goto", offset); } }); }); } $(window).resize(function () { eResize(); }); eResize(); setTimeout(function() { eResize(); }, 250); eMulgasu(".eMulgasu"); if ($("#page-content").length > 0) { eChangePage(10); } $(".eMulgasu").eq(0).remove(); if ($(".gallery-container").length > 0 && !/Android|webOS|iPhone|iPod|iPad|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { setInterval(function() { if ($(".gallery-container").attr("goto") != null) { var current = parseInt($(".gallery-container").position().left); var target = parseInt($(".gallery-container").attr("goto")); var shift = (target-current); if (shift > $(window).width()) {shift = $(window).width();} else if (shift < -$(window).width()) {shift = -$(window).width();} var next = current + shift/10; $(".gallery-container").css("left", next+"px"); } }, 20); } $(".some").each(function () { if ($(this).find(".some-bg .bg").attr("style") == "background-image: url('');") { $(this).find(".centerize").css("opacity", 1); } }); });