var $ = jQuery.noConflict(); $(document).ready(function() { // color schemes $('.change-style ul a').click(function(event) { event.preventDefault(); var appendcss = "colors-" + $(this).closest('li').attr('class').replace(/\s.+$/, ""); $('head').append(''); }); // mobile menu $('nav#mainmenu > ul').mobileMenu({ defaultText: 'Navigation', subMenuDash: '–' }); $('.select-menu').wrap('
'); // init Magnific popup $('.popup, .gallery-icon a').magnificPopup({ type: 'image', gallery:{enabled:true}, titleSrc: 'alt', cursor: 'mfp-zoom-out-cur' }); // hiding default text in form fields $('[placeholder]').focus(function() { var input = $(this); if (input.val() == input.attr('placeholder')) { input.val(''); input.removeClass('placeholder'); } }).blur(function() { var input = $(this); if (input.val() == '' || input.val() == input.attr('placeholder')) { input.addClass('placeholder'); input.val(input.attr('placeholder')); } }).blur(); // dropdownmenu $('.children, .sub-menu').hide(); $('nav ul li:has(ul)').mouseenter(function() { $(this).find('a').addClass('active-parent'); $(this).find('> .children, > .sub-menu').slideDown('fast'); }).mouseleave(function() { $(this).find('a').removeClass('active-parent'); $(this).find('> .children, > .sub-menu').hide(); }); // searchbox $('#sitesearch i').mouseenter(function() { $('#search-box').css('display','block'); }); $('#search-box').mouseleave(function() { $('#search-box').hide(); }); }); $(window).load(function() { // Homepage carousel gallery var home_gallery = $('.home .gallery'); if (home_gallery.length > 0) { $('.home .gallery-item').unwrap(); home_gallery.wrapInner(''); home_gallery.wrap(''); $('#latest-projects').append(''); // init jCarousel for portfolio projects home_gallery.jcarousel({ 'visible': 4, 'wrap': 'both' }); $('.prev1').click(function() { $('.gallery').jcarousel('scroll', '-=1'); }); $('.next1').click(function() { $('.gallery').jcarousel('scroll', '+=1'); }); } // Recent news carousel var news_carousel = $('.home .carousel-vert4'); if (news_carousel.length > 0) { // init jCarousel for recent news news_carousel.jcarousel({ 'vertical': true, 'visible': 4, 'wrap': 'both' }); $('#recent-news .prev2').click(function() { $('.carousel-vert4').jcarousel('scroll', '-=1'); }); $('#recent-news .next2').click(function() { $('.carousel-vert4').jcarousel('scroll', '+=1'); }); } // Testimonials widget var testimonials_carousel = $('.widget #quotes'); if (testimonials_carousel.length > 0) { // init Cycle for testimonials testimonials_carousel.cycle({ fx: 'fade', speed: 400, timeout: 0, cleartype: false, next: '#quotes-nav .next2', prev: '#quotes-nav .prev2', slideResize: true, fit: 1, width: '100%' }); } // Client logos var logos_carousel = $('.widget .carousel7'); if (logos_carousel.length > 0) { // init jCarousel for client logos logos_carousel.jcarousel({ 'wrap': 'circular' }).jcarouselAutoscroll({ 'interval': 2000, 'autostart': true, 'target': '+=1' }); } // Gallery Post Type Gallery var gallery_cycle = $('.post-format-gallery .gallery:first'); if (gallery_cycle.length > 0) { // init Cycle for gallery gallery_cycle.wrap(''); gallery_cycle.find('.gallery-item').unwrap(); gallery_cycle.after(''); gallery_cycle.cycle({ fx: 'fade', speed: 300, timeout: 4000, cleartype: true, next: '.next2', prev: '.prev2' }); } // Quote author image $('blockquote').next('p').children('.quote-author').siblings('img').css('margin-top','-40px'); }); $(window).resize(function() { });