(function ($, undefined) { /*var W3CDOM = (document.createElement && document.getElementsByTagName); function initFileUploads() { if (!W3CDOM) return; var fakeFileUpload = document.createElement('div'); fakeFileUpload.className = 'fakefile'; fakeFileUpload.appendChild(document.createElement('input')); var image = document.createElement('img'); image.src='pix/button_select.gif'; fakeFileUpload.appendChild(image); var x = document.getElementsByTagName('input'); for (var i=0;i'); //$('.fileinputs .file-cv').append(''); /*$('.fileinputs .fakefile .wpcf7-form-control').click(function() { //$('.fileinputs .file.hidden').click(); //$('.fileinputs .file.hidden').trigger('click'); //$('.fileinputs .fakefile .wpcf7-form-control').val($('.fileinputs .file.hidden').val()); });*/ $('.fileinputs .filepdf').change(function(){ $('input[name=fakefile]').val($('.fileinputs .filepdf').val()); }); var portfolioImages = $('.portfolios.sortable img.lazy'); if (portfolioImages.length) { portfolioImages.jail({ speed: 1400, event: "load", callback: function () { setTimeout(function () { $(".portfolios.sortable").each(function () { var list = $('ul', this); var items = $("li", list); var links = $('.sort_by_cat a', this); list.css({ width: list.width(), height: list.height(), position: "relative" }); var places = []; items.each(function (i, item) { var box = { top: item.offsetTop, left: item.offsetLeft }; $(this).css(box); box.height = $(item).height(); box.width = $(item).width(); places.push(box); }); var columns = { portfolio_two_columns: 2, portfolio_three_columns: 3, portfolio_four_columns: 4 }; items.css({ position: "absolute" }); fixRowHeights(items); function getNumColumns() { for (var c in columns) { if (list.hasClass(c)) { return columns[c]; } } return 1; } function fixRowHeights(items) { var cols = getNumColumns(); if (cols > 1) { var h = 0, bottomLine = 0, last = items[0]; items.each(function (j) { $(this).css({ height: "auto" }); h = Math.max(h, $(this).outerHeight()); $(this).css({ top: bottomLine }) if ((j + 1) % cols === 0 || j == items.length - 1) { $(this).prevUntil(last).andSelf().css({ height: h, marginTop: 0, marginBottom: 0 }); bottomLine += h + 20; h = 0; last = this; } }); } } links.each(function (i, link) { var cat = $(this).attr('data-value'); var toShow = cat == 'all' ? items : items.filter('[data-type*=' + cat + ']'); var toHide = cat == 'all' ? $() : items.not('[data-type*=' + cat + ']'); $(this).click(function (e) { links.removeClass('active'); $(this).addClass('active'); var cols = getNumColumns(); var H = 0, L = toShow.length, curH = 0, $img, bottomLine = 0, last = toShow[0]; toShow.each(function (j) { $img = $(this).stop(1, 0).css("zIndex", 2); if (!$img.is(":visible")) { $img.css({ opacity: 0, display: "block" }); } $img.css({ height: "auto" }).data("targetPositionTop", places[j].top); curH = Math.max(curH, $img.outerHeight()); if (cols > 1) { if ((j + 1) % cols === 0 || j == L - 1) { var coll = $img.prevUntil(last).andSelf(); if (toShow.index(last) === 0) { coll.add(last); } coll.data("targetPositionTop", bottomLine).css({ height: curH }); bottomLine += curH + 20; curH = 0; last = this; } } }).each(function (j) { $(this).delay(j * 100).animate({ opacity: [1, "linear"], top: $.data(this, "targetPositionTop"), left: places[j].left }, 800, "easeInOutExpo", function() { $(this).addClass("no-filter"); }); H = Math.max(H, places[j].top + $(this).height()); }); list.animate({ height: bottomLine || H }, 600, "easeInOutExpo", function() { $(window).trigger("scroll"); }); toHide.filter(":visible").each(function (j) { $(this).stop(1, 0).delay(j * 100).queue(function() { $(this) .css({zIndex: 1}) .removeClass("no-filter") .animate({opacity: "hide"}, 800, "linear"); }).dequeue(); }); return false; }); }); }); }, 0); } }); } // Fullwidth slider is without rounded corners if( ! $(".header-slider-wrapper").hasClass("fullwidth") ) { $(".wpv-wrapper").corner(); } $('#commentform, .searchform').validator(); $("nav > div > ul > li:last").css("paddingRight", 0); $("nav.main-nav ul li").each(function (i, o) { $(this).find("ul").css({ visibility: "hidden", display: "none", opacity: 0 }); $(this).hover( function () { $('ul:first', this).stop(1, 1).delay(200).queue(function () { if ($(o).is(".hover")) { return; } var submenu = $('ul:first', o); var thisOffset = $(o).offset(); var vw = $(window).width(); var isFirst = submenu.is("nav > div > ul > li > ul"); submenu.css({ visibility: "hidden", display: "inline-block" }); $(o).addClass("hover"); if (thisOffset.left + $(o).outerWidth({margin: true}) + submenu.outerWidth({margin: true}) > vw) { submenu.css({ right: isFirst ? 0 : "100%", left: "auto" }); } else { submenu.css({ left: isFirst ? 0 : "100%", right: "auto" }); } $(this).css({ opacity: 0, visibility: "visible" }).animate({ opacity: 1 }, 200, "linear").dequeue(); }); }, function () { $('ul:first', this).stop(1, 0).delay(200).queue(function () { $(this).animate({ opacity: 0 }, 100, "linear", function () { $(this).css({ display: "none" }); $(o).removeClass("hover"); }).dequeue(); }); }); }); $("nav.section-nav ul li").each(function (i, o) { $(this).find("ul").css({ visibility: "hidden", display: "none", opacity: 0 }); }); $("nav.section-nav ul li.current-menu-item, nav.section-nav ul li.current-page-ancestor").each(function (i, o) { $(this).find("ul").css({ visibility: "visible", display: "inline", opacity: 1 }); }); $("nav ul li ul li:has(ul)").find("a:first").append(" » "); $('.post-head a img').parent().addClass('a-reset'); $('.sitemap li:not(:has(.children))').addClass('single'); var tooltip_animation = 250; $('.shortcode-tooltip').hover(function () { $(this).find('.tooltip').fadeIn(tooltip_animation).animate({ bottom: 25 }, tooltip_animation); }, function () { $(this).find('.tooltip').animate({ bottom: 35 }, tooltip_animation).fadeOut(tooltip_animation); }); // hover effects ------------------------------------------------------------- $(".thumbnail").live({ mouseenter: function (e) { $(".info-pad", this).each(function () { if ($(this).css("position") == "absolute") { $(this).stop(1, 0).delay(100).queue(function () { $(this).css("zIndex", 2).animate({ opacity: 1 }, 400, "linear"); }).dequeue(); } }); }, mouseleave: function (e) { $(".info-pad", this).each(function () { if ($(this).css("position") == "absolute") { $(this).stop(1, 0).delay(100).animate({ opacity: 0 }, 400, "linear", function () { $(this).css("zIndex", -1); }); } }); } }); // adds the 'carved' button arrow $('a.button.carved, .button.carved a').append(function () { return $('
').css({ bottom: -5, left: 0, right: 0 }).append(function () { return $('
').css({ margin: 'auto', width: 0, height: 0, borderLeft: '10px solid transparent', borderRight: '10px solid transparent', borderBottom: '5px solid #fff' }); }); }); // scroll to top button $(window).bind('resize scroll', function () { if (window.pageYOffset > 0) $('#scroll-to-top').fadeIn('normal'); else $('#scroll-to-top').fadeOut('normal'); }); $('#scroll-to-top').click(function () { $('html,body').animate({ scrollTop: 0 }, 300); }); /* header slider */ function getThumbSrc(dir, slider) { var src = "about:blank"; var nextSlide = slider.wpvSlider(dir == "next" ? "getNextSlide" : "getPreviousSlide"); if (nextSlide.length) { src = nextSlide = nextSlide.find("> .wpv-slide").data("thumb") || ""; } return src; } function setThumb(dir, slider) { var btn = $(dir == "next" ? ".wpv-nav-next" : ".wpv-nav-prev", slider.parent()); var thumb = btn.find("> img.wpv-preview-thumb"); var thumbSrc = getThumbSrc(dir, slider); if (thumbSrc) { if (!thumb.length) { thumb = $('').appendTo(btn); } thumb.attr("src", thumbSrc).css({ visibility: "visible" }); } else { thumb.css({ visibility: "hidden" }); } } $("#header-slider, .slider-shortcode").bind("afterChange sliderload", function () { setThumb("next", $(this)); setThumb("prev", $(this)); }); // slide the nav buttons with the navigation-preview design $(".style-navigation-preview .wpv-nav-next, .style-gallery .wpv-nav-next").live("mouseenter", function () { $(this).stop(1, 0).animate({ marginLeft: -$(this).outerWidth(), opacity: 1 }); }).live("mouseleave", function () { $(this).stop(1, 0).animate({ marginLeft: -40, opacity: 0.3 }); }); $(".style-navigation-preview .wpv-nav-prev, .style-gallery .wpv-nav-prev").live("mouseenter", function () { $(this).stop(1, 0).animate({ marginRight: -$(this).outerWidth(), opacity: 1 }); }).live("mouseleave", function () { $(this).stop(1, 0).animate({ marginRight: -40, opacity: 0.3 }); }); // helpers for the peek slider design $(".style-peek .wpv-nav-next").live("mouseenter", function () { $(this).stop(1, 0).animate({ width: 50 }, 130); }).live("mouseleave", function () { $(this).stop(1, 0).animate({ width: 40 }, 130); }); $(".style-peek .wpv-nav-prev").live("mouseenter", function () { $(this).stop(1, 0).animate({ marginLeft: 0 }, 130); }).live("mouseleave", function () { $(this).stop(1, 0).animate({ marginLeft: -10 }, 130); }); $(".style-peek #header-slider").one("sliderload", function (e, slider) { $(".wpv-slide-wrapper", slider.view).each(function (i, o) { $.data(o, "Slide").getCaption(); // Click to scroll $(o).click(function () { if (!$(o).is(".active")) { slider.goTo(i); return false; } }) }); $("#header-slider-caption-wrapper").show(); }); $(".style-peek #header-slider").one("beforeChange", function (e, slider, slideToShow, slideToHide) { var cur = slideToHide || slideToShow; var next = cur.next(".wpv-slide-wrapper"); if (!next.length) { next = cur.parent().find(".wpv-slide-wrapper:first"); } next.show().css({ left: cur.position().left + cur.width() + 20 }); }); }); // Internet Explorer fixes if ($.browser.msie && $.browser.version == 8) { /* if(WPV_THEME_URI) { // Shadows fix $('.shadow, .sep-3').hide(); $('.dark .shadow, .dark .sep-3').after(''); $('.light .shadow, .light .sep-3').after(''); $('body').bind('wpv-class-change', function() { $('.ie-shadow').show(); $('.classic .ie-shadow').hide(); }); } */ $('p:empty').hide(); // Last child elements $('p:last-child, ul li:last-child, ol li:last-child, .widget:last-child, .accordion:last-child, .toggle:last-child, .toggle_content:last-child').addClass('last'); } })(jQuery);