// jQuery.noConflict(); (function($, window, document) { "use strict"; // calendar var calendar = $('#mycalendar'); if (calendar.length) { // expression $('#mycalendar').monthly({ mode: 'event', //jsonUrl: 'events.json', //dataType: 'json' // xmlUrl: 'events.xml' }); } switch (window.location.protocol) { case 'http:': case 'https:': // running on a server, should be good. break; case 'file:': console.log('Just a heads-up, events will not work when run locally.'); } // audio player new jPlayerPlaylist({ jPlayer: "#jquery_jplayer_1", cssSelectorAncestor: "#jp_container_1" }, [{ title: "Cro Magnon Man", artist: "The Stark Palace", mp3: "http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3", oga: "http://www.jplayer.org/audio/ogg/TSP-01-Cro_magnon_man.ogg", poster: "http://www.jplayer.org/video/poster/Big_Buck_Bunny_Trailer_480x270.png" }, { title: "Your Face", artist: "The Stark Palace", mp3: "http://www.jplayer.org/audio/mp3/TSP-05-Your_face.mp3", oga: "http://www.jplayer.org/audio/ogg/TSP-05-Your_face.ogg", poster: "http://www.jplayer.org/video/poster/Finding_Nemo_Teaser_640x352.png" }, { title: "Cyber Sonnet", artist: "The Stark Palace", mp3: "http://www.jplayer.org/audio/mp3/TSP-07-Cybersonnet.mp3", oga: "http://www.jplayer.org/audio/ogg/TSP-07-Cybersonnet.ogg", poster: "http://www.jplayer.org/video/poster/Incredibles_Teaser_640x272.png" }], { // swfPath: "../../dist/jplayer", supplied: "oga, mp3", useStateClassSkin: true, autoBlur: false, smoothPlayBar: true, play: function(el) { var songImage = $(this).find('img').attr('src'); $('.js-jp-audio-img .jp-type-single').css('background-image', 'url(' + songImage + ')'); }, ready: function(el) { var songImage = $(this).find('img').attr('src'); $('.js-jp-audio-img .jp-type-single').css('background-image', 'url(' + songImage + ')'); }, keyEnabled: true }); new jPlayerPlaylist({ jPlayer: "#jquery_jplayer_2", cssSelectorAncestor: "#jp_container_2" }, [{ title: "Cro Magnon Man", artist: "The Stark Palace", mp3: "http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3", oga: "http://www.jplayer.org/audio/ogg/TSP-01-Cro_magnon_man.ogg", poster: "http://www.jplayer.org/video/poster/Big_Buck_Bunny_Trailer_480x270.png" }, { title: "Your Face", artist: "The Stark Palace", mp3: "http://www.jplayer.org/audio/mp3/TSP-05-Your_face.mp3", oga: "http://www.jplayer.org/audio/ogg/TSP-05-Your_face.ogg", poster: "http://www.jplayer.org/video/poster/Finding_Nemo_Teaser_640x352.png" }, { title: "Cyber Sonnet", artist: "The Stark Palace", mp3: "http://www.jplayer.org/audio/mp3/TSP-07-Cybersonnet.mp3", oga: "http://www.jplayer.org/audio/ogg/TSP-07-Cybersonnet.ogg", poster: "http://www.jplayer.org/video/poster/Incredibles_Teaser_640x272.png" }, { title: "Cro Magnon Man", artist: "The Stark Palace", mp3: "http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3", oga: "http://www.jplayer.org/audio/ogg/TSP-01-Cro_magnon_man.ogg", poster: "http://www.jplayer.org/video/poster/Big_Buck_Bunny_Trailer_480x270.png" }, { title: "Your Face", artist: "The Stark Palace", mp3: "http://www.jplayer.org/audio/mp3/TSP-05-Your_face.mp3", oga: "http://www.jplayer.org/audio/ogg/TSP-05-Your_face.ogg", poster: "http://www.jplayer.org/video/poster/Finding_Nemo_Teaser_640x352.png" }, { title: "Cyber Sonnet", artist: "The Stark Palace", mp3: "http://www.jplayer.org/audio/mp3/TSP-07-Cybersonnet.mp3", oga: "http://www.jplayer.org/audio/ogg/TSP-07-Cybersonnet.ogg", poster: "http://www.jplayer.org/video/poster/Incredibles_Teaser_640x272.png" }], { // swfPath: "../../dist/jplayer", supplied: "oga, mp3", useStateClassSkin: true, autoBlur: false, smoothPlayBar: true, play: function(el) { var songImage = $(this).find('img').attr('src'); $('.js-jp-audio-img2 .jp-type-single').css('background-image', 'url(' + songImage + ')'); $('.js-jp-audio-img2 .jp-img').css('background-image', 'url(' + songImage + ')'); }, ready: function(el) { var songImage = $(this).find('img').attr('src'); $('.js-jp-audio-img2 .jp-img').css('background-image', 'url(' + songImage + ')'); $('.js-jp-audio-img2 .jp-type-single').css('background-image', 'url(' + songImage + ')'); }, keyEnabled: true }); // video background // video background var video = $('#video'); if (video.length) { // expression var options = { videoId: 'QyD4koQWVCk', start: 3 }; $('#video').tubular(options); } $('.container').fitVids(); /*============================*/ /* 01 - VARIABLES */ /*============================*/ var swipers = [], winW, winH, winScr, _isresponsive, smPoint = 768, mdPoint = 992, lgPoint = 1200, addPoint = 1600, _ismobile = navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i); /*========================*/ /* 02 - PAGE CALCULATIONS */ /*========================*/ function pageCalculations() { winW = $(window).width(); winH = $(window).height(); } /*=================================*/ /* 03 - FUNCTION ON DOCUMENT READY */ /*=================================*/ pageCalculations(); //smoothscroll $('.menu-item a').on('click', function(e) { var target = this.hash, jtarget = $(target); if (jtarget.length) { e.preventDefault(); $(document).off("scroll"); var margTarg = jtarget.find('> div.vc_row').css('margin-top'); var margTargColumn = jtarget.find('> div.vc_row > div > .vc_column-inner').css('margin-top'); if (parseInt(margTarg) < 0) { margTarg = margTarg; } else { margTarg = 0; } if (parseInt(margTargColumn) < 0) { margTargColumn = margTargColumn; } else { margTargColumn = 0; } var targ = $(this); $('.menu-item a').each(function() { $(this).parent().removeClass('active'); }); targ.parent().addClass('active'); $('html, body').stop().animate({ 'scrollTop': jtarget.offset().top + parseInt(margTarg) + parseInt(margTargColumn) - 75 }, 500, 'swing', function() { $(document).on('scroll', onScroll); }); } }); function onScroll(event) { var scrollPos = $(document).scrollTop(); $('.menu-item a').each(function() { var currLink = $(this); var refElement = $('#' + currLink.attr("href").split('#')[1]); if (refElement.length) { var margTarg = refElement.find('> div.vc_row').css('margin-top'); var margTargColumn = refElement.find('> div.vc_row > div > .vc_column-inner').css('margin-top'); if (parseInt(margTarg) < 0) { margTarg = margTarg; } else { margTarg = 0; } if (parseInt(margTargColumn) < 0) { margTargColumn = margTargColumn; } else { margTargColumn = 0; } if ((refElement.position().top + parseInt(margTarg) + parseInt(margTargColumn) - 75) <= scrollPos && (refElement.position().top + refElement.height()) > scrollPos) { $('.menu-item a').parent().removeClass("active"); currLink.parent().addClass("active"); } } }); } $(document).on("scroll", onScroll); $(window).on("load", function() { setTimeout(onScroll, 500) }); // contactSocial function contactSocial() { var $contactInfo = $('.contact-info .social a.cust'); if ($contactInfo.length) { var hover = $contactInfo.attr('data-hover'); $contactInfo.hover(function() { $(this).css('color' + '', hover); }, function() { $(this).css("color", "white"); }); } } /***********************************/ /* MAGNIFIC POPUP*/ /**********************************/ // gallery mode $('.gal-item').magnificPopup({ gallery: { enabled: true }, mainClass: 'mfp-fade', fixedContentPos: true, fixedBgPos: true, type: 'image' }); $('.popup_content').magnificPopup({ type: 'image', midClick: true, fixedContentPos: true, fixedBgPos: true, mainClass: 'odessa-portfolio-wrap', gallery: { enabled: true } }); function gallerySize() { var $odessaPortfolio = $('.odessa-portfolio-wrap'); if ($odessaPortfolio.length && $(window).width() > 767) { $('.odessa-portfolio-wrap.style1').each(function() { var gallery = $(this); gallery.find('.item').each(function() { $(this).height($(this).width()); }); gallery.find('.item:nth-child(10n + 4)').each(function() { $(this).height(($(this).width() * 2 + 10)); }); gallery.find('.item:nth-child(10n + 5)').each(function() { $(this).height(($(this).width())); }); gallery.find('.item:nth-child(10n + 7)').each(function() { $(this).height(($(this).width() / 2 - 5)); }); gallery.find('.item:nth-child(10n + 8)').each(function() { $(this).height(($(this).width() / 2 - 5)); }); gallery.find('.item.cub').each(function() { $(this).height(($(this).width())); }); }); $('.odessa-portfolio-wrap.style2').each(function() { var gallery = $(this); gallery.find('.item').each(function() { $(this).height($(this).width()); }); gallery.find('.item:nth-child(10n + 4)').each(function() { $(this).height(($(this).width())); }); gallery.find('.item:nth-child(10n + 3)').each(function() { $(this).height(($(this).width() / 2 - 5)); }); gallery.find('.item:nth-child(10n + 7)').each(function() { $(this).height(($(this).width() / 2 - 5)); }); gallery.find('.item:nth-child(10n + 8)').each(function() { $(this).height(($(this).width() / 2 - 5)); }); gallery.find('.item.cub').each(function() { $(this).height(($(this).width())); }); }); $('.odessa-portfolio-wrap.style3').each(function() { var gallery = $(this); gallery.find('.item').each(function() { $(this).height(($(this).width())); }); }) } else if ($('.odessa-portfolio-wrap').length && $(window).width() > 600) { $('.odessa-portfolio-wrap:not(.style3)').each(function() { var gallery = $(this); gallery.find('.item').each(function() { $(this).height($(this).width() - 5); }); }); $('.odessa-portfolio-wrap.style3').each(function() { var gallery = $(this); gallery.find('.item').each(function() { $(this).height($(this).width()); }); }); } else if ($('.odessa-portfolio-wrap').length) { $('.odessa-portfolio-wrap').each(function() { var gallery = $(this); gallery.find('.item').each(function() { $(this).height($(this).width()); }); }) } // blog post size var $postList = $('.posts-list-wrap'); if ($postList.length && $(window).width() > 767) { $postList.each(function(index) { $(this).find('.post-block').css('height', 'auto').equalHeights(); }); } else if ($postList.length) { $postList.each(function(index) { $(this).find('.post-block').css('height', 'auto'); }); } } gallerySize(); function menuClick() { var wdth = $(window).width(); if (wdth < 992) { $('.odessa-top-menu nav li a').on('click', function() { if (!$(this).parent().hasClass('menu-item-has-children')) { $('header').removeClass('active'); $('.nav-button').removeClass('active'); $('body').removeClass('overflow'); } }); } } $('.load-more').each(function() { $(this).on('click', function(e) { e.preventDefault(); var portfolio_parent = $(this).closest('.odessa-portfolio-wrap'); portfolio_parent.find('.hidden-item').removeClass('hidden-item'); $(this).parent().parent().css('display', 'none'); portfolio_parent.find('.izotope-container').isotope('destroy').isotope({ itemSelector: '.item', layoutMode: 'masonry', masonry: { columnWidth: '.item', percentPosition: true } }); }); }); function pagination() { $('.pagination-color').each(function(index) { var color = $(this).attr('data-color'); var active = $(this).parent().find('.swiper-pagination-switch'); active.each(function(index) { if ($(this).hasClass('swiper-active-switch')) { $(this).css('background-color', color); } else { $(this).removeAttr('style'); } }); }); } var wdth; function widthW() { wdth = $(window).width(); } widthW(); if ($('.menu-item-has-children').length) { $('.menu-item-has-children > a').each(function(index) { $(this).after('') }); } $('.menu-item-has-children > span').on('click', function(e) { widthW(); if (!$('header').hasClass('full') || wdth < 992) { $(this).parent().find('> ul').slideToggle('slow'); } }); $('.widget_nav_menu .menu-item-has-children span').each(function() { $(this).on('click', function() { $(this).parent().children('.sub-menu').slideToggle('fast'); }); }); function footerposition() { if ($('.footer-wrap.no')) { $('footer.no').addClass('pos-abs'); var pad = $('footer.no').height(); $('body').css('padding-bottom', pad + 'px'); } else { $('footer').removeClass('pos-abs'); $('body').css('padding-bottom', '0px!important'); } } footerposition(); function headerMenuPosition() { var wdth = $(window).width(); if (wdth < 992) { $('header').addClass('full'); $('header div.odessa-top-menu').css('top', '99%'); } if (wdth > 991) { $('header div.odessa-top-menu').css('top', '0px'); } } headerMenuPosition(); $('.nav-button').on('click', function() { overflow(); $(this).toggleClass('active'); $('header').toggleClass('active'); var wdth = $(window).width(); if (wdth < 992) { $('body').toggleClass('overflow'); } }); function playlistwidth() { var $playList = $('.cue-playlist-container'); if ($playList.length) { $playList.each(function() { if ($(this).width() < 381) { $(this).addClass('responsivemob'); $('.cue-playlist.max-width-380 .cue-skin-default.mejs-container .mejs-track-artwork img').addClass('s-img-switch'); } else if ($(this).width() < 480) { $(this).addClass('responsive'); $(this).removeClass('responsivemob'); $('.cue-playlist.max-width-380 .cue-skin-default.mejs-container .mejs-track-artwork img').removeClass('s-img-switch'); } else { $(this).removeClass('responsive'); $(this).removeClass('responsivemob'); $('.cue-playlist.max-width-380 .cue-skin-default.mejs-container .mejs-track-artwork img').removeClass('s-img-switch'); } }) } } playlistwidth(); function overflow() { var wdth = $(window).width(); if (wdth < 992 && $('header').hasClass('active')) { $('body').addClass('overflow'); } else { $('body').removeClass('overflow'); } } overflow(); function overflowno() { var wdth = $(window).width(); if (wdth > 991) { $('body').removeClass('overflow'); } } overflowno(); /***********************************/ /* BACKGROUND*/ /**********************************/ //sets child image as a background function wpc_add_img_bg(img_sel, parent_sel) { if (!img_sel) { console.info('no img selector'); return false; } var $parent, $imgDataHidden, _this; $(img_sel).each(function() { _this = $(this); $imgDataHidden = _this.data('s-hidden'); $parent = _this.closest(parent_sel); $parent = $parent.length ? $parent : _this.parent(); $parent.css('background-image', 'url(' + this.src + ')').addClass('s-back-switch'); if ($imgDataHidden) { _this.css('visibility', 'hidden'); } else { _this.hide(); } }); } function animateBanner() { $('.banner-wrap .info').addClass('active'); $('.blog-title').addClass('active'); $('.blog-subtitle').addClass('active'); } setTimeout(animateBanner, 1500); var $izotop = $('.izotope-container'); var $izotop2 = $('.izotope-container-2'); function izotopeFunc() { if ($izotop.length) { $izotop.each(function() { var self = $(this); self.isotope({ itemSelector: '.item', layoutMode: 'masonry', masonry: { columnWidth: '.item', percentPosition: true } }); }); } if ($izotop2.length) { $izotop2.each(function() { var self2 = $(this); self2.isotope({ itemSelector: '.experiences-items', layoutMode: 'masonry', masonry: { columnWidth: '.experiences-items' } }); }); } } izotopeFunc(); function izotopeFunc2() { if ($izotop.length) { $izotop.each(function() { var self = $(this); self.isotope('destroy').isotope({ itemSelector: '.item', layoutMode: 'masonry', masonry: { columnWidth: '.item', percentPosition: true } }); }); } if ($izotop2.length) { $izotop2.each(function() { var self2 = $(this); self2.isotope('destroy').isotope({ itemSelector: '.experiences-items', layoutMode: 'masonry', masonry: { columnWidth: '.experiences-items' } }); }); } } /*============================*/ /* 04 - FUNCTION ON PAGE LOAD */ /*============================*/ $(window).on('load', function() { initSwiper(); gallerySize(); contactSocial(); widthW(); $('.preload-wrap').fadeOut(1000); menuClick(); playlistwidth(); wpc_add_img_bg('.s-img-switch'); izotopeFunc(); if ($('footer .cust').length) { var st = $('footer .cust').attr('data-style'); $('footer .cust').find('form input[type="submit"]').attr('style', st); } if ($(this).scrollTop() >= 350 && (!$('header').hasClass('not'))) { $('header').addClass('full'); } var menucolor = $('.odessa-top-menu.custom').attr('style'); if ($('header').hasClass('full')) { $('header.full > div.container').attr('style', menucolor); $('header.full .sub-menu').attr('style', menucolor); } else { $('header > div.container').removeAttr('style'); } if ($('#wpadminbar').length) { $('header').css('top', '32px'); } // AOS.init({ // easing: 'ease-out-back', // animation: 1000 // }); }); window.addEventListener("orientationchange", function() { headerMenuPosition(); overflowno(); overflow(); menuClick(); playlistwidth(); gallerySize(); widthW(); izotopeFunc(); izotopeFunc2(); footerposition(); }); /*==============================*/ /* 05 - FUNCTION ON PAGE RESIZE */ /*==============================*/ function resizeCall() { pageCalculations(); $('.swiper-container.initialized[data-slides-per-view="responsive"]').each(function() { var thisSwiper = swipers['swiper-' + $(this).attr('id')], $t = $(this), slidesPerViewVar = updateSlidesPerView($t), centerVar = thisSwiper.params.centeredSlides; thisSwiper.params.slidesPerView = slidesPerViewVar; thisSwiper.reInit(); if (!centerVar) { var paginationSpan = $t.find('.pagination span'); var paginationSlice = paginationSpan.hide().slice(0, (paginationSpan.length + 1 - slidesPerViewVar)); if (paginationSlice.length <= 1 || slidesPerViewVar >= $t.find('.swiper-slide').length) $t.addClass('pagination-hidden'); else $t.removeClass('pagination-hidden'); paginationSlice.show(); } }); } if (!_ismobile) { $(window).on('resize',function() { resizeCall(); }); } else { window.addEventListener("orientationchange", function() { resizeCall(); }, false); } $(window).on('resize', function() { headerMenuPosition(); initSwiper(); overflowno(); overflow(); playlistwidth(); widthW(); gallerySize(); menuClick(); var menucolor = $('.odessa-top-menu.custom').attr('style'); if ($('header').hasClass('full')) { $('header.full > div.container').attr('style', menucolor); $('header.full .sub-menu').attr('style', menucolor); } izotopeFunc(); izotopeFunc2(); footerposition(); }); /*=====================*/ /* 06 - SWIPER SLIDERS */ /*=====================*/ function initSwiper() { var initIterator = 0; $('.swiper-container').each(function() { var $t = $(this); var index = 'swiper-unique-id-' + initIterator; $t.addClass('swiper-' + index + ' initialized').attr('id', index); $t.find('.pagination').addClass('pagination-' + index); var autoPlayVar = parseInt($t.attr('data-autoplay'), 10); var mode = $t.attr('data-mode'); var slidesPerViewVar = $t.attr('data-slides-per-view'); if (slidesPerViewVar == 'responsive') { slidesPerViewVar = updateSlidesPerView($t); } else slidesPerViewVar = parseInt(slidesPerViewVar, 10); var loopVar = parseInt($t.attr('data-loop'), 10); var speedVar = parseInt($t.attr('data-speed'), 10); var centerVar = parseInt($t.attr('data-center'), 10); swipers['swiper-' + index] = new Swiper('.swiper-' + index, { speed: speedVar, pagination: '.pagination-' + index, loop: loopVar, paginationClickable: true, autoplay: autoPlayVar, slidesPerView: slidesPerViewVar, keyboardControl: true, calculateHeight: true, simulateTouch: true, roundLengths: true, centeredSlides: centerVar, mode: mode || 'horizontal', onInit: function(swiper) { $t.find('.swiper-slide').addClass('active'); pagination(); }, onSlideChangeEnd: function(swiper) { var activeIndex = (loopVar === 1) ? swiper.activeLoopIndex : swiper.activeIndex; }, onSlideChangeStart: function(swiper) { $t.find('.swiper-slide.active').removeClass('active'); pagination(); } }); swipers['swiper-' + index].reInit(); if ($t.attr('data-slides-per-view') == 'responsive') { var paginationSpan = $t.find('.pagination span'); var paginationSlice = paginationSpan.hide().slice(0, (paginationSpan.length + 1 - slidesPerViewVar)); if (paginationSlice.length <= 1 || slidesPerViewVar >= $t.find('.swiper-slide').length) $t.addClass('pagination-hidden'); else $t.removeClass('pagination-hidden'); paginationSlice.show(); } if ($t.find('.default-active').length) { swipers['swiper-' + index].swipeTo($t.find('.swiper-slide').index($t.find('.default-active')), 0); } initIterator++; }); } function updateSlidesPerView(swiperContainer) { if (winW >= addPoint) return parseInt(swiperContainer.attr('data-add-slides'), 10); else if (winW >= lgPoint) return parseInt(swiperContainer.attr('data-lg-slides'), 10); else if (winW >= mdPoint) return parseInt(swiperContainer.attr('data-md-slides'), 10); else if (winW >= smPoint) return parseInt(swiperContainer.attr('data-sm-slides'), 10); else return parseInt(swiperContainer.attr('data-xs-slides'), 10); } //swiper arrows $('.swiper-arrow-left').on('click', function() { swipers['swiper-' + $(this).parent().attr('id')].swipePrev(); }); $('.swiper-arrow-right').on('click', function() { swipers['swiper-' + $(this).parent().attr('id')].swipeNext(); }); $('.swiper-outer-left').on('click', function() { swipers['swiper-' + $(this).parent().find('.swiper-container').attr('id')].swipePrev(); }); $('.swiper-outer-right').on('click', function() { swipers['swiper-' + $(this).parent().find('.swiper-container').attr('id')].swipeNext(); }); $('.progress-circle').viewportChecker({ callbackFunction: function(elem, action) { if ($('.progress-circle').length && !$('.progress-circle').hasClass('done')) { $('.progress-circle').circleProgress({ size: 182, emptyFill: 'rgba(255,255,255,0)', thickness: 15, lineCap: 'round', reverse: false, startAngle: -Math.PI / 4 * 2, fill: { color: "rgba(255,255,255,.45)" } }).on('circle-animation-progress', function(event, progress) { var self = $(this); self.find('strong').html(parseInt((self.attr('data-value') * 100) * progress) + '%'); $(this).addClass('done'); }); } } }); /***********************************/ /*WINDOW SCROLL*/ /**********************************/ $(window).on('scroll', function() { if ($(this).scrollTop() >= 350) { if (!$('header').hasClass('scroll full') && !$('header').hasClass('done') && !$('header').hasClass('not')) { $('header').addClass('scroll done'); var wdth = $(window).width(); if (wdth > 991) { $('header').addClass('top'); setTimeout(function() { $('header').addClass('full').removeClass('top'); var menucolor = $('.odessa-top-menu.custom').attr('style'); if ($('header').hasClass('full')) { $('header.full > div.container').attr('style', menucolor); $('header.full .sub-menu').attr('style', menucolor); } else { $('header > div.container').removeAttr('style'); } }, 200); } } } else if (!$('header').hasClass('yes')) { $('header').removeClass('scroll done'); var wdth = $(window).width(); if (wdth > 991) { $('header').removeClass('full'); } } var menucolor = $('.odessa-top-menu.custom').attr('style'); if ($('header').hasClass('full')) { $('header.full > div.container').attr('style', menucolor); $('header.full .sub-menu').attr('style', menucolor); } else { $('header > div.container').removeAttr('style'); } }); $('.widget_search input').attr('placeholder', 'Search'); if (window.load_more_post) { var pageNum = parseInt(load_more_post.startPage) + 1; // The maximum number of pages the current query can return. var max = parseInt(load_more_post.maxPage); // The link of the next page of posts. var nextLink = load_more_post.nextLink; $('.odessa-load-more').on('click', function(e) { if (pageNum <= max) { var $izotop = $('.izotope-container'); $.ajax({ url: nextLink, type: "get", success: function(data) { var newElements = $(data).find('.izotope-container .item'); var elems = []; newElements.each(function(i) { elems.push(this); }); $izotop.isotope('insert', elems); gallerySize(); izotopeFunc2(); wpc_add_img_bg('.s-img-switch'); pageNum++; nextLink = nextLink.replace(/\/page\/[0-9]?/, '/page/' + pageNum); if (pageNum == (max + 1)) { $('.odessa-load-more').hide('fast'); } } }); } return false; }); } if ($('.widget_search input[type="submit"]').length) { $('.widget_search input[type="submit"]').attr('value', '').wrap('
'); } $('.single-content form').submit(function() { var required = $('[required]'); // change to [required] if not using true option as part of the attribute as it is not really needed. var error = false; for (var i = 0; i <= (required.length - 1); i++) { if (required[i].value == '' || !required[i].validity.valid) // tests that each required value does not equal blank, you could put in more stringent checks here if you wish. { required[i].style.border = '1px solid rgb(255,155,155)'; error = true; // if any inputs fail validation then the error variable will be set to true; } } if (error) // if error is true; { return false; // stop the form from being submitted. } }); $('.wpcf7 form').on('submit',function() { var required = $('[aria-required="true"]'); var error = false; for (var i = 0; i <= (required.length - 1); i++) { if (required[i].value == '' || !required[i].validity.valid) // tests that each required value does not equal blank, you could put in more stringent checks here if you wish. { required[i].style.border = '1px solid rgb(255,155,155)'; error = true; // if any inputs fail validation then the error variable will be set to true; } } if (error) // if error is true; { return false; // stop the form from being submitted. } }); })(jQuery, window, document);