$(document).ready(function(e) { $(".post-container").hover(function(){ $(this).find(".title-shadow").toggle(); },function(){ $(this).find(".title-shadow").toggle(); }); $(".load-more").click(function(e){ e.preventDefault(); $(".load-more").hide(); $("hr").hide(); var target = $(this).attr('href'); $.get(target, function(data){ $(data).find(".content-container").appendTo(".content-container"); }); }); $(".nav-menu").click(function(){ $(".menu-items-ul").toggle(); }); if($("#gallery").length){ // Declare variables var totalImages = $("#gallery > li > img").length, imageWidth = $("#gallery > li > img:first").outerWidth(true), totalWidth = imageWidth * totalImages, visibleImages = Math.round($(".framesholder").width() / (imageWidth + 5)), visibleWidth = visibleImages * imageWidth, stopPosition = (visibleWidth - totalWidth) imgmargin = parseInt($("#gallery > li:first").css("margin-left"),10), skipitems = 3; $("#gallery").width(totalWidth); $(".arrow-left").click(function(){ if($("#gallery").position().left < 0 && !$("#gallery").is(":animated")){ $("#gallery").animate({left : "+=" + (skipitems * (imageWidth + imgmargin)) + "px"}); } return false; }); $(".arrow-right").click(function(){ if($("#gallery").position().left > stopPosition && !$("#gallery").is(":animated")){ $("#gallery").animate({left : "-=" + (skipitems * (imageWidth + imgmargin)) + "px"}); } return false; }); $(".next-image").click(function(){ if($("#displayedimg").next($(".post-image-item")).length){ var displayeditem = $("#displayedimg").next($(".post-image-item")); }else{ var displayeditem = $(".post-image-item:first"); } $(".post-image-item").fadeOut(); $(".post-image-item").attr("id",""); $(displayeditem).attr("id","displayedimg"); $(displayeditem).fadeIn("slow"); }); $(".previous-image").click(function(){ if($("#displayedimg").prev($(".post-image-item")).length){ var displayeditem = $("#displayedimg").prev($(".post-image-item")); }else{ var displayeditem = $(".post-image-item:last"); } $(".post-image-item").fadeOut(); $(".post-image-item").attr("id",""); $(displayeditem).attr("id","displayedimg"); $(displayeditem).fadeIn("slow"); }); $(".play-pause").click(function(){ if($(".play-pause").attr("id")=="pp-pause"){ clearInterval(timer); $(".play-pause").attr("id", "pp-play"); }else{ timer = window.setInterval(sliderplay, 3000); $(".play-pause").attr("id", "pp-pause"); } }); $(".frame-img").click(function(){ var tid = $(this).attr("tid"); $(".post-image-item").fadeOut(); $(".post-image-item").attr("id",""); $(".post-image-item[tid='" + tid + "']").attr("id","displayedimg"); $(".post-image-item[tid='" + tid + "']").fadeIn(); }); function sliderplay(){ if($("#displayedimg").next($(".post-image-item")).length){ var displayeditem = $("#displayedimg").next($(".post-image-item")); }else{ var displayeditem = $(".post-image-item:first"); } $(".post-image-item").fadeOut(); $(".post-image-item").attr("id",""); $(displayeditem).attr("id","displayedimg"); $(displayeditem).fadeIn("slow"); } var scrheight = $(window).height() - 100; var scrwidth = $(window).width(); $(".post-image-item").css("max-height", scrheight + "px"); $(".post-image-item").css("max-width", scrwidth + "px"); $(".post-image-item:first").attr("id","displayedimg"); $(".post-image-item:first").fadeIn(); $(".play-pause").attr("id", "pp-pause"); var timer = 0; timer = window.setInterval(sliderplay, 3000); } if($(".film-roll").length){ $(document).mousemove(function(e){ var relpos = e.pageY / $(window).height(); if(relpos > 0.70 ){ $(".film-roll").show("slow"); }else{ $(".film-roll").hide("slow"); } }); } });