(function($) { 'use strict'; /*------------------------------------------------------------------------------- cookies -------------------------------------------------------------------------------*/ function setcookie(cname, cvalue, days) { if (days) { var date = new date(); date.settime(date.gettime() + (days * 24 * 60 * 60 * 1000)); var expires = "; expires=" + date.togmtstring(); } else { var expires = ""; } document.cookie = cname + "=" + cvalue + expires + "; path=/"; } //return a particular cookie function getcookie(cname) { var name = cname + "="; var decodedcookie = decodeuricomponent(document.cookie); var ca = decodedcookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charat(0) == ' ') { c = c.substring(1); } if (c.indexof(name) == 0) { return c.substring(name.length, c.length); } } return ""; } //checks if a cookie exists function checkcookie(cookietocheck) { var cookie = getcookie(cookietocheck); if (cookie != "") { return true; } return false; } //delet an existing cookie function deletecookie(name) { document.cookie = name + '=; expires=thu, 01 jan 1970 00:00:01 gmt;'; } /*------------------------------------------------------------------------------- newsletter popup close and set cookie -------------------------------------------------------------------------------*/ $(".newsletter-popup-trigger").on('click', function(){ setcookie('newsletter_popup_viewed', 'true'); $(".sigma_popup").removeclass('show'); }); $('#sigma_popup-newsletter').on('hidden.bs.modal', function () { setcookie('newsletter_popup_viewed', 'true'); }); /*------------------------------------------------------------------------------- mobile nav and toggles -------------------------------------------------------------------------------*/ $(".aside-trigger").on('click', function() { $("body").toggleclass('aside-open'); }); $(".aside-trigger-right").on('click', function() { $("body").toggleclass('aside-right-open'); }); $(".sigma_aside .menu-item-has-children > a").on('click', function(e) { var submenu = $(this).next(".sub-menu"); e.preventdefault(); submenu.slidetoggle(200); }); /*------------------------------------------------------------------------------- search trigger -------------------------------------------------------------------------------*/ $(".search-trigger").on('click', function(e) { $(".search-form-wrapper").toggleclass('open'); }); /*------------------------------------------------------------------------------- tooltips -------------------------------------------------------------------------------*/ $('[data-toggle="tooltip"]').tooltip(); /*------------------------------------------------------------------------------- sticky header -------------------------------------------------------------------------------*/ var header = $(".can-sticky"); var headerheight = header.innerheight(); function dosticky() { if (window.pageyoffset > headerheight) { header.addclass("sticky"); } else { header.removeclass("sticky"); } } dosticky(); /*------------------------------------------------------------------------------- team socials trigger -------------------------------------------------------------------------------*/ $("a.trigger-team-socials").on('click', function(e) { e.preventdefault(); $(this).closest('.sigma_social-icons').toggleclass('visible'); }); /*------------------------------------------------------------------------------- back to top -------------------------------------------------------------------------------*/ function stickbacktotop() { if (window.pageyoffset > 400) { $('.sigma_top').addclass('active'); } else { $('.sigma_top').removeclass('active'); } } stickbacktotop(); $('body').on('click', '.sigma_top', function() { $("html, body").animate({ scrolltop: 0 }, 600); return false; }); /*------------------------------------------------------------------------------- progress bar on view -------------------------------------------------------------------------------*/ $(".sigma_progress").each(function() { var progressbar = $(this).find(".progress-bar"); var progresscount = $(this).find(".sigma_progress-count"); $(progressbar).one('inview', function(event, isinview) { if (isinview) { $(progressbar).animate({ width: $(progressbar).attr("aria-valuenow") + "%" }, function() { $(progresscount).animate({ left: $(progressbar).attr("aria-valuenow") + "%", opacity: 1 }); }); } }); }); $(".sigma_progress-round").each(function() { var animateto = $(this).data('to'), $this = $(this); $this.one('inview', function(event, isinview) { if (isinview) { $this.css({'stroke-dashoffset': animateto}); } }); }); /*------------------------------------------------------------------------------- magnific popup -------------------------------------------------------------------------------*/ $('.popup-video').magnificpopup({type: 'iframe'}); $('.gallery-thumb').magnificpopup({ type: 'image', gallery: { enabled: true } }); /*------------------------------------------------------------------------------- ion range sliders (price filter) -------------------------------------------------------------------------------*/ $(".js-range-slider").ionrangeslider(); /*------------------------------------------------------------------------------- masonry -------------------------------------------------------------------------------*/ $('.masonry').imagesloaded(function() { var isotopecontainer = $('.masonry'); isotopecontainer.isotope({itemselector: '.masonry-item'}); }); /*------------------------------------------------------------------------------ isotope ------------------------------------------------------------------------------*/ var $isotopegrid; $('.sigma_isotope-filter').imagesloaded(function() { $isotopegrid = $('.sigma_isotope-filter').isotope({ itemselector: '.col-lg-4', percentposition: true, masonry: { columnwidth: '.col-lg-4' } }); }); $('.sigma_isotope-filter-items').on('click', '.sigma_isotope-trigger', function() { var filtervalue = $(this).attr('data-filter'); $isotopegrid.isotope({filter: filtervalue}); }); $('.sigma_isotope-trigger').on('click', function(e) { $(this).closest('.sigma_isotope-filter-items').find('.active').removeclass('active'); $(this).addclass('active'); event.preventdefault(); }); /*------------------------------------------------------------------------------- counter js -------------------------------------------------------------------------------*/ $(".counter").each(function() { var $this = $(this); $this.one('inview', function(event, isinview) { if (isinview) { $this.countto({speed: 2000}); } }); }); /*------------------------------------------------------------------------------- password toggle js -------------------------------------------------------------------------------*/ $(".password-toggle").on('click', function() { $(this).toggleclass("fa-eye fa-eye-slash"); var input = $(this).next(), inputtype = input.attr("type") == "password" ? 'text' : 'password'; input.attr("type", inputtype); }); /*------------------------------------------------------------------------------- instagram feed -------------------------------------------------------------------------------*/ $('.widget-insta').each(function() { var $this = $(this); $.instagramfeed({ 'username': $this.data('username'), 'container': '#' + $this.attr('id'), 'display_profile': false, 'display_biography': false, 'display_gallery': true, 'display_captions': false, 'styling': false, 'items': parseint($this.data('items')), 'items_per_row': parseint($this.data('items_per_row')), 'lazy_load': true }); }); /*------------------------------------------------------------------------------- smooth scroll -------------------------------------------------------------------------------*/ $('.detail-menu-list .nav-item .nav-link').on( 'click', function(event) { var target = $(this.hash); if (target.length) { $('html,body').animate({ scrolltop: target.offset().top - 20 }, 1500); return false; } }); /*------------------------------------------------------------------------------- banner slider -------------------------------------------------------------------------------*/ $(".sigma_banner-slider").slick({ slidestoshow: 1, slidestoscroll: 1, arrows: false, dots: true, autoplay: false, centermode: true, centerpadding: 0, }); /*------------------------------------------------------------------------------- gallery format slider -------------------------------------------------------------------------------*/ // $(".post-format-gallery .sigma_post-thumb").slick({ // slidestoshow: 1, // slidestoscroll: 1, // arrows: true, // dots: true, // autoplay: false, // centermode: true, // centerpadding: 0, // responsive: [ // { // breakpoint: 767, // settings: { // arrows: false // } // } // ] // }); /*------------------------------------------------------------------------------- team slider -------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------- on scroll functions -------------------------------------------------------------------------------*/ $(window).on('scroll', function() { // sticky header dosticky(); // back to top stickbacktotop(); }); })(jquery);