Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function($) {
- /********************
- Open all external links open in a new tab apart from a domain
- *********************/
- var all_links = document.querySelectorAll('#content a');
- for (var i = 0; i < all_links.length; i++){
- var a = all_links[i];
- if(a.hostname != location.hostname && a.hostname != "javascript:void(0)") {
- a.rel = 'noopener';
- a.target = '_blank';
- }
- }
- /*****************************
- ADA Compliance
- ******************************/
- var menuItems = document.querySelectorAll('.desktop-nav .menu li.menu-item-has-children, #top-navigation .menu li.menu-item-has-children');
- Array.prototype.forEach.call(menuItems, function(el, i){
- var activatingA = el.querySelector('a');
- var btn = '<button><span><span class="visuallyhidden">show submenu for “' + activatingA.text + '”</span></span></button>';
- activatingA.insertAdjacentHTML('afterend', btn);
- el.querySelector('button').addEventListener("click", function(event){
- if (this.parentNode.className == "menu-item-has-children") {
- this.parentNode.className = "menu-item-has-children open";
- this.parentNode.querySelector('a').setAttribute('aria-expanded', "true");
- this.parentNode.querySelector('button').setAttribute('aria-expanded', "true");
- } else {
- this.parentNode.className = "menu-item-has-children";
- this.parentNode.querySelector('a').setAttribute('aria-expanded', "false");
- this.parentNode.querySelector('button').setAttribute('aria-expanded', "false");
- }
- event.preventDefault();
- });
- });
- $(function() {
- $('.wpcf7-form-control-wrap').attr('role','none');
- $('.vc_tta-controls-icon').attr('role','none');
- $('.vc_empty_space_inner').attr('role','none');
- $('figure').attr('role','none');
- $('.menu .menu-item-has-children > a').attr('aria-haspopup','true');
- $('.menu .menu-item-has-children > a').attr('aria-expanded','false');
- $('#content .vc_btn3-container > a[target*="_blank"], a[target*="_blank"]').each(function(){
- var buttonTitle = $(this).attr('title');
- $(this).attr('aria-label', buttonTitle);
- // $("<span class='warning'>Open in new window</span>").appendTo(this);
- });
- $('.menu a[target*="_blank"]:not(".fa")').each(function(){
- var buttontext = $(this).text();
- $(this).attr('aria-label', buttontext + ' link will open in new tab or window');
- $(this).attr('role', 'button');
- });
- $('.menu a:not(".fa")').each(function(){
- var buttontext = $(this).text();
- $(this).attr('aria-label', 'View ' + buttontext);
- $(this).attr('role', 'button');
- });
- $('.gform_validation_errors').attr('role', 'alert');
- });
- /*****************************
- Hide Sub menu using ESC
- ******************************/
- $(document).ready(function() {
- $(document).keyup(function(e) {
- if (e.keyCode == 27) { // Esc keycode
- $('.sub-menu').hide();
- $('.sign-in-menu').hide();
- }
- });
- });
- /*****************************
- END ADA Compliance
- ******************************/
- $("#toTop a").click(function () {
- $("html, body").animate({scrollTop: 0}, 1000);
- });
- /*****************************
- Container Left/Right auto sizing
- ******************************/
- function LRContainerPadding() {
- const elementstyle = document.getElementById("main-container");
- const cssObjstyle = window.getComputedStyle(elementstyle, null);
- let marginLeft = cssObjstyle.getPropertyValue("margin-left");
- let marginRight = cssObjstyle.getPropertyValue("margin-right");
- if($(window).width() <= 1999) {
- $('.container_left').css('padding-left',marginLeft );
- $('.container_right').css('padding-right',marginRight );
- }
- }
- LRContainerPadding();
- $(document).ready(function() {
- LRContainerPadding();
- $(window).resize(function() {
- LRContainerPadding();
- });
- });
- /*****************************
- Header Height / mobile custom phone
- ******************************/
- function headerResizefunction() {
- var windowWidth = $(window).width();
- var headerHeight = $('.header_wrapper').outerHeight();
- var bannerHeight = $('.alert-modal').outerHeight();
- var wpadminbarOuterHeight = $('#wpadminbar').outerHeight();
- if ($('#wpadminbar').length){
- headerOffset = wpadminbarOuterHeight;
- } else {
- headerOffset = 0;
- }
- // if (windowWidth >= 1081) {
- // $('.header_wrapper').stickit({
- // screenMinWidth: 1081,
- // top: headerOffset
- // });
- // }
- $('.header_wrapper').css('top', headerOffset);
- $('.close-alert').click(function(){
- var mainNav = $('.main-header').outerHeight();
- $('.header_wrapper').find('.alert-modal').hide();
- $('.main-nav').css('top', headerHeight);
- $('#content').css('margin-top', mainNav);
- if($('.header_wrapper').hasClass('transparent_header')){
- $('#content').css('margin-top', 0);
- }
- });
- if (windowWidth <= 991) { // For MObile
- // $('.header_wrapper').css('top', headerOffset);
- // $('#content').css('margin-top',headerHeight);
- if ($('#wpadminbar').length){
- $('.main-nav').css('top', headerHeight + headerOffset);
- } else {
- $('.header_wrapper').css('top', 0);
- $('.main-nav').css('top', headerHeight - 1);
- }
- if ($('.vc_row.hero_section, .vc_row.inner_hero, .vc_section.hero_section, .vc_section.inner_hero').length) {
- $('.header_wrapper').addClass('transparent_header');
- // $('#content').css('margin-top', headerHeight);
- } else {
- $('.header_wrapper').addClass('solid_header');
- $('#content').css('margin-top', headerHeight);
- }
- } else {
- if ($('.vc_row.hero_section, .vc_row.inner_hero, .vc_section.hero_section, .vc_section.inner_hero').length) {
- $('.header_wrapper').addClass('transparent_header');
- $('#content').css('margin-top', 0);
- } else {
- $('.header_wrapper').addClass('solid_header');
- $('#content').css('margin-top', headerHeight);
- }
- }
- }
- $(document).ready(function() {
- headerResizefunction();
- $(window).resize(function() {
- headerResizefunction();
- });
- });
- /********************
- Sticky Navs
- *********************/
- function stickyNavs() {
- var headerHeight = $('.header_wrapper').outerHeight();
- var wpadminbarOuterHeight = $('#wpadminbar').outerHeight();
- if ($('#wpadminbar').length){
- headerOffset = wpadminbarOuterHeight + headerHeight;
- } else {
- headerOffset = headerHeight;
- }
- // Site Navigator
- // $('.sticky_nav').stickit({
- // top: headerOffset,
- // scope: StickScope.Document,
- // });
- }
- stickyNavs();
- /*****************************
- Sticky Header
- ******************************/
- $(window).scroll(function() {
- var winTop = $(window).scrollTop();
- if (winTop >= 20) {
- $(".main-header").addClass("sticky");
- } else {
- $(".main-header").removeClass("sticky");
- }
- });
- var didScroll;
- // on scroll, let the interval function know the user has scrolled
- $(window).scroll(function(event){
- didScroll = true;
- });
- // run hasScrolled() and reset didScroll status
- setInterval(function() {
- if (didScroll) {
- hasScrolled();
- didScroll = false;
- }
- }, 250);
- function hasScrolled() {
- // do stuff here...
- }
- $(window).on("scroll", function() {
- didScroll = true;
- scrollTop = $(document).scrollTop();
- var windowWidth = $(window).width();
- if (windowWidth <= 1024) {
- var s = 190 - Math.min(190, scrollTop);
- } else {
- var s = 190 - Math.min(190, scrollTop);
- if (scrollTop === 0) {
- $(".light_logo").css('opacity',1);
- }
- }
- if( ($(".main-header").hasClass('sticky')) && ($(".main-header").hasClass('transparent_header'))) {
- } else {
- $(".light_logo").hide();
- $(".dark_logo").show();
- // $(".dark_logo").css("opacity", $(window).scrollTop() / 150);
- $(".fake-bg").css("opacity", 0+ $(window).scrollTop() / 120);
- if (scrollTop === 0) {
- $(".dark_logo").hide();
- $(".light_logo").show();
- }
- }
- });
- // Scroll Position
- var didScroll;
- var lastScrollTop = 0;
- var delta = 5;
- var navbarHeight = $('header').outerHeight();
- $(window).scroll(function(event){
- didScroll = true;
- });
- setInterval(function() {
- if (didScroll) {
- hasScrolled();
- didScroll = false;
- }
- }, 250);
- function hasScrolled() {
- var st = $(this).scrollTop();
- var banner_exist = $(".have-slider-banner").length;
- if(banner_exist > 0) {
- if(Math.abs(lastScrollTop - st) <= delta)
- return;
- if (st > lastScrollTop && st > navbarHeight){
- // Scroll Down
- $('header').addClass('sticky');
- } else {
- // Scroll Up
- if(st + $(window).height() < $(document).height()) {
- //$('header').removeClass('sticky');
- }
- if(st == 0) {
- $('header').removeClass('sticky');
- }
- }
- }
- lastScrollTop = st;
- }
- // mobile menu dropdown & sticky header condition for without slider/banner page
- jQuery(document).ready(function() {
- if ($(window).width() < 991) {
- $('#navigation ul.menu > li.menu-item-has-children').click(function() {
- $('> ul', this).slideToggle(200);
- });
- }
- });
- /*****************************
- Custom Accordion
- ******************************/
- $(function() {
- $('.custom_accordion .accordion_wrapper').each(function(index){
- $(this).find('.accordion_title').attr("data-id", index);
- if(index === 0) {
- $(this).addClass('active');
- }
- });
- $('.acc_subcontent').each(function(index){
- $(this).attr("id", index);
- if(index === 0) {
- $(this).addClass('active');
- }
- mainAcc = $('.custom_accordion .accordion_wrapper .accordion_title[data-id=' + index + ']').parent().find(".accordion_inner");
- $(this).clone().appendTo(mainAcc);
- });
- $('.custom_accordion .accordion_wrapper .accordion_title').on('click', function () {
- if ($(this).parent().hasClass('active')) {
- $(this).parent().removeClass('active');
- } else {
- $('.custom_accordion .accordion_wrapper .accordion_inner').hide();
- $('.custom_accordion .accordion_wrapper').removeClass('active');
- $(this).parent().addClass('active');
- $('.custom_accordion .accordion_wrapper.active .accordion_inner').slideToggle();
- }
- });
- $(".accordion_title").click(function() {
- if ($(".accordion_wrapper").hasClass("active") == true) {
- $('.acc_subcontent:visible').hide();
- console.log($(this).data("id"));
- $('.acc_subcontent[id=' + $(this).data("id") + ']').delay(300).fadeIn();
- } else {
- $('.acc_subcontent:visible').hide();
- }
- });
- });
- // Custom Tabs With arrows
- // $(function() {
- // $('.tab-prev').click(function() {
- // if ($('.vc_tta-panels .vc_tta-panel.vc_active').prev().length != 0) {
- // $('.vc_tta-panels .vc_tta-panel.vc_active').removeClass('vc_active').prev().addClass('vc_active').click();
- // $('.vc_tta-tabs-list .vc_tta-tab.vc_active').removeClass('vc_active').prev().addClass('vc_active').click();
- // }
- // });
- // $('.tab-next').click(function() {
- // if ($('.vc_tta-panels .vc_tta-panel.vc_active').next().length != 0) {
- // $('.vc_tta-panels .vc_tta-panel.vc_active').removeClass('vc_active').next().addClass('vc_active').click();
- // $('.vc_tta-tabs-list .vc_tta-tab.vc_active').removeClass('vc_active').next().addClass('vc_active').click();
- // }
- // });
- // });
- /*****************************
- Modal
- ******************************/
- $(function() {
- setTimeout(function() {
- $('.members_modal, .calculator_modal').appendTo('footer.footer');
- $('.search_modal').appendTo('.search_modal_footer');
- }, 1000);
- jQuery("div[id^='modal']").each(function(){
- var currentModal = jQuery(this);
- //click next
- currentModal.find('.btn-next').click(function(){
- currentModal.modal('hide');
- currentModal.closest("div[id^='modal']").nextAll("div[id^='modal']").first().modal('show');
- });
- //click prev
- currentModal.find('.btn-prev').click(function(){
- currentModal.modal('hide');
- currentModal.closest("div[id^='modal']").prevAll("div[id^='modal']").first().modal('show');
- });
- });
- });
- /*****************************
- Mobile Page Menu
- ******************************/
- $(function() {
- var windowWidth = $(window).width();
- if (windowWidth <= 767) {
- $('.page_menu .widget_nav_menu').prepend("<a class='open-page-menu'>Open Menu</a>");
- var pageMenuActive = $('.page_menu .widget_nav_menu').find('.current_page_item a').text();
- $('.open-page-menu').text(pageMenuActive);
- $('.open-page-menu').click(function(){
- $(this).next('div').slideToggle();
- });
- }
- });
- /*****************************
- Slick Sliders
- ******************************/
- // Image/Video Gallery
- $(function() {
- $('.image_video_gallery__container').not('.slick-initialized').slick({
- slidesToShow: 1,
- slidesToScroll: 1,
- arrows: false,
- dots: true,
- prevArrow: $('.image_video_gallery .slider-control .prev'),
- nextArrow: $('.image_video_gallery .slider-control .next'),
- });
- });
- // Image Meta Slider
- $(function() {
- let asNav = ''
- if($('.image_slider__content').length) {
- asNav = '.image_slider__content'
- $('.image_slider__content').slick({
- slidesToShow: 1,
- slidesToScroll: 1,
- dots: false,
- fade: true,
- asNavFor: '.image_slider__container'
- });
- }
- $('.image_slider__container').not('.slick-initialized').slick({
- respondTo: 'slider',
- slidesToShow: 1,
- slidesToScroll: 1,
- dots: false,
- fade: false,
- infinite: false,
- prevArrow: $('.image_slider__control .prev'),
- nextArrow: $('.image_slider__control .next'),
- asNavFor: asNav,
- });
- });
- // Device Specific Slider
- $(function() {
- var windowWidth = $(window).width();
- // Tablet
- if(windowWidth <= 1024) {
- }
- // Mobile
- if (windowWidth <= 767) {
- $('.counter_boxes.vertical_slider .slider-container').not('.slick-initialized').slick({
- slidesToShow: 4,
- slidesToScroll: 4,
- vertical: true,
- arrows: true,
- prevArrow: $('.counter_boxes .slider-control .prev'),
- nextArrow: $('.counter_boxes .slider-control .next'),
- });
- $('.mobile_slider .slider-container').not('.slick-initialized').slick({
- slidesToShow: 1,
- slidesToScroll: 1,
- arrows: true,
- fade: true,
- prevArrow: $('.mobile_slider:not(.counter_boxes) .slider-control .prev'),
- nextArrow: $('.mobile_slider:not(.counter_boxes) .slider-control .next'),
- adaptiveHeight: true,
- });
- $('.gallery-slider').not('.slick-initialized').slick({
- slidesToShow: 1,
- slidesToScroll: 1,
- arrows: false,
- });
- }
- });
- /*****************************
- Graphs / Charts / Odometer
- ******************************/
- $(function() {
- $('.counter').countUp({
- 'time': 2000,
- 'delay': 30
- });
- });
- /********************
- Mobile tabs
- *********************/
- $(function() {
- var windowWidth = $(window).width();
- if (windowWidth <= 767) {
- $(window).load(function(){
- var activeloadedText= $('.vc_tta-tab.vc_active > a .vc_tta-title-text').text();
- $('.mobile_tab_menu').text(activeloadedText);
- });
- $(".vertical_tabs").each(function(){
- var mobileMenu = $(this).find('.mobile_tab_menu');
- var tabItem = $(this).find('.vc_tta-tab > a');
- var activeText = $(this).find(".vc_tta-tab.vc_active .vc_tta-title-text").text();
- mobileMenu.text(activeText);
- mobileMenu.click(function(e){
- e.preventDefault();
- $(this).toggleClass("active");
- $(this).parent().find('.vc_tta.vc_tta-tabs .vc_tta-tabs-container').toggleClass("show");
- });
- $('.footer-col a').click(function(e){
- var activeClickedtextonPage = $(this).text();
- mobileMenu.text(activeClickedtextonPage);
- $('body').find('.vc_tta.vc_tta-tabs .vc_tta-tabs-container').removeClass("show");
- mobileMenu.removeClass("active");
- });
- tabItem.click(function(e){
- var activeClickedtext = $(this).find('.vc_tta-title-text').text();
- mobileMenu.text(activeClickedtext);
- e.preventDefault();
- $(this).parents().find('.vc_tta.vc_tta-tabs .vc_tta-tabs-container').removeClass("show");
- mobileMenu.removeClass("active");
- });
- });
- }
- });
- /********************
- Mobile VC ROW Swap
- *********************/
- $(function() {
- var windowWidth = $(window).width();
- if (windowWidth <= 767) {
- $('.vc_row.mobile_swap').wrapAll('<div class="mobile_swap_wrapper" />');
- }
- });
- $(document).ready(function() {
- var bodyToggle = $('body');
- $('.mobile-toggle-wrap').click(function() {
- bodyToggle.toggleClass('collapse_menu');
- });
- function mobile_navigation() {
- var windowWidth_1024px = $(window).width();
- if (windowWidth_1024px <= 1279) {
- // Second Level
- $('#mobile-menu li.menu-item-has-children').each(function(el) {
- $(this).prepend("<a class='open-menu'></a>");
- });
- $('#mobile-menu li.menu-item-has-children:has(ul)').addClass("inactive");
- $('#mobile-menu li.menu-item-has-children:has(ul) ul').css('display', 'none');
- $('.open-menu').click(function() {
- if ($(this).closest('li.menu-item-has-children').hasClass('active')){
- $(this + 'a').attr('aria-expanded','false');
- }
- if ($(this).closest('li.menu-item-has-children').hasClass('inactive')){
- $(this + 'a').attr('aria-expanded','true');
- }
- var checkElement = $(this).next().next();
- $(this).parent('li.menu-item-has-children ').removeClass('active');
- $(this).parent('li.menu-item-has-children').addClass('active').removeClass("inactive");
- if ((checkElement.is('ul')) && (checkElement.is(':visible'))) {
- console.log
- $(this).parent().siblings('li.menu-item-has-children').removeClass('active').addClass('inactive');
- checkElement.slideUp('normal');
- }
- if ((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
- $('ul ul:visible').not($(this).closest('ul')).slideUp('normal');
- checkElement.slideDown('normal');
- }
- if (checkElement.is('ul')) {
- return false;
- } else {
- return true;
- }
- });
- // END Third Level Dropdown
- $('#mobile-menu')
- }
- }
- mobile_navigation();
- });
- $('a[href^="#"].scrollTo, .scrollTo a[href^="#"], .scrollTo a').click(function()
- {
- var bodyToggle = $('body');
- bodyToggle.toggleClass('collapse_menu');
- if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
- || location.hostname == this.hostname)
- {
- var target = $(this.hash),
- headerHeight = $('.header_wrapper').outerHeight(),
- stickyNav = $('.sticky_nav').outerHeight(), // Get fixed header height
- target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
- headerOffset = headerHeight + stickyNav;
- headerOffset = headerOffset + 60;
- if (target.length)
- {
- $('html,body').animate({
- scrollTop: target.offset().top - headerOffset
- }, 500);
- return false;
- }
- }
- });
- // Site Navigator
- $('#navigation a[href^="#"].scrollNav, #navigation .scrollNav a[href^="#"], #navigation .scrollNav a').click(function()
- {
- var bodyToggle = $('body');
- bodyToggle.toggleClass('collapse_menu');
- if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
- || location.hostname == this.hostname)
- {
- var target = $(this.hash),
- headerHeight = $('.header_wrapper').outerHeight(),
- stickyNav = $('.sticky_nav').outerHeight(), // Get fixed header height
- target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
- headerOffset = headerHeight + stickyNav;
- headerOffset = headerOffset + 60;
- if (target.length)
- {
- $('html,body').animate({
- scrollTop: target.offset().top - headerOffset
- }, 1000, 'swing');
- return false;
- }
- }
- });
- // to top right away
- if ( window.location.hash ) scroll(0,0);
- // void some browsers issue
- setTimeout( function() { scroll(0,0); }, 1);
- $(function() {
- headerHeight = $('.header_wrapper').outerHeight(),
- stickyNav = $('.sticky_nav').outerHeight(), // Get fixed header height
- headerOffset = headerHeight + stickyNav;
- scrollPadding = $('.vc_tta-tabs').length ? 120 : 0
- setTimeout(function() {
- // *only* if we have anchor on the url
- if(window.location.hash) {
- // smooth scroll to the anchor id
- $('html, body').animate({
- scrollTop: $(window.location.hash).offset().top - headerOffset - scrollPadding
- }, 1000, 'swing');
- }
- }, 1000);
- });
- function removeBR() {
- if ($(window).width() <= 1080) {
- $('.banner h4 br').remove();
- $('.vc_custom_heading br').remove();
- $('.hero_section p br').remove();
- $('.wpb_text_column:not(.contact_details) p br').remove();
- $('.sub_content br').remove();
- $('.scrollToNav h6 br').remove();
- $('.resource_slider__nav .resource_slider__title br').remove();
- }
- $('.details_content p:empty').remove();
- }
- $(window).resize(removeBR);
- $(window).load(removeBR);
- $(document).ready(removeBR);
- $(function() {
- let accordionTarget = document.querySelectorAll('.custom_accordion__target > div')
- let accordionToggle = document.querySelectorAll('.vc_tta-panels .vc_tta-panel')
- let accordionRowTarget = document.querySelectorAll('.custom_accordion__row .vc_row')
- let accordionRowToggle = document.querySelectorAll('.custom_boxes .box_wrap')
- function initAccordionTarget(target, trigger) {
- if(target.length > 1) {
- target[0].classList.add('active')
- trigger.forEach(function(e, i) {
- e.addEventListener('click', function() {
- triggerTarget(target, i)
- })
- })
- }
- }
- function triggerTarget(elem, i) {
- elem.forEach(function(j) {
- if(j.classList.contains('active')) {
- j.classList.remove('active')
- }
- })
- elem[i].classList.add('active')
- }
- initAccordionTarget(accordionTarget, accordionToggle)
- initAccordionTarget(accordionRowTarget, accordionRowToggle)
- $('.custom_accordion .vc_tta-panels').on('beforeChange', function(event, slick, currentSlide, nextSlide){
- if(accordionTarget.length > 0)
- triggerTarget(accordionTarget, nextSlide)
- });
- $('.custom_boxes').on('beforeChange', function(event, slick, currentSlide, nextSlide){
- if(accordionRowTarget.length > 0) {
- triggerTarget(accordionRowTarget, currentSlide)
- }
- });
- })
- $('#copy_text').click(function (e) {
- e.preventDefault();
- // var copyText = window.location.href;
- // //var copyText = $(this).attr('href');
- // document.addEventListener('copy', function(e) {
- // e.clipboardData.setData('text/plain', copyText);
- // e.preventDefault();
- // }, true);
- // document.execCommand('copy');
- // $("#tooltiptext").text("Copied");
- var dummy = document.createElement('input'),
- text = window.location.href;
- document.body.appendChild(dummy);
- dummy.value = text;
- dummy.select();
- document.execCommand('copy');
- document.body.removeChild(dummy);
- $("#tooltiptext").text("Copied");
- });
- $("#copy_text").mouseleave(function () {
- $("#tooltiptext").text("Copy to clipboard");
- });
- $('.vc_tta-tab').each(function() {
- $(this).click(function() {
- setTimeout(function() {
- $('.image_slider__container, .image_slider__meta').slick('reinit');
- }, 500)
- });
- });
- jQuery(function($){
- // Chosen Select
- $(".gfield_select, .vc_grid-styled-select select").select2({
- minimumResultsForSearch: -1
- });
- });
- })($);
- // Filter
- jQuery(function($){
- $('.filter_wrap form input:radio').click(function() {
- $('.filter_wrap form input:radio').not(this).prop('checked', false);
- $(".filter_wrap form input[type='radio']").parent().removeClass('active');
- $(this).parent().addClass('active');
- });
- $('#filter').change(function(){
- var filter = $('#filter');
- $.ajax({
- url:filter.attr('action'),
- data:filter.serialize(), // form data
- type:filter.attr('method'), // POST
- beforeSend:function(xhr){
- },
- success:function(data){
- $('.filter_results').html(data); // insert data
- }
- });
- return false;
- });
- });
- $('[data-fancybox]').fancybox({
- maxWidth: "90%",
- infobar : false,
- buttons : false,
- afterLoad : function( instance, current ) {
- if ( instance.group.length > 1 && current.$content ) {
- current.$content.append('<a data-fancybox-next class="button-next" href="javascript:;"><i class="fa-solid fa-arrow-right-long"></i></a><a data-fancybox-prev class="button-previous" href="javascript:;"><i class="fa-solid fa-arrow-left-long"></i></a>');
- }
- current.$content.append('<a data-fancybox-close class="button-close" href="javascript:;">×</a>');
- },
- beforeShow: function() {
- $('.caption--image').remove();
- },
- afterShow: function() {
- var caption = $(".fancybox-caption"),
- innerCaption = caption.clone().addClass('caption--image');
- $(".fancybox-slide--current .fancybox-content").append(innerCaption);
- caption.not('.caption--image').addClass('caption--bottom');
- }
- });
- jQuery(document).ready(function($) {
- // Add a dropdown toggle button dynamically
- var activeText = $('.filter_main li.active label').text();
- $('.filter_main').before('<div id="dropdownToggle">' + activeText + '</div>');
- // Always start as collapsed on mobile
- if (window.innerWidth <= 768) {
- $('.filter_main').addClass('collapsed');
- }
- // Toggle dropdown visibility
- $('#dropdownToggle').on('click', function() {
- $('.filter_main').toggleClass('collapsed');
- });
- // Update active item and dropdown text
- $('.filter_main li').on('click', function() {
- $('.filter_main li').removeClass('active');
- $(this).addClass('active');
- var selectedText = $(this).find('label').text();
- $('#dropdownToggle').text(selectedText);
- $('.filter_main').addClass('collapsed');
- });
- // Close dropdown when clicking outside
- $(document).on('click', function(e) {
- if (!$(e.target).closest('#dropdownToggle, .filter_main').length) {
- $('.filter_main').addClass('collapsed');
- }
- });
- // Re-check on window resize
- $(window).on('resize', function() {
- if (window.innerWidth > 768) {
- $('.filter_main').removeClass('collapsed');
- } else {
- $('.filter_main').addClass('collapsed');
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement