/*------------------------------------------------------------------ * [Table of Contents] * * 1. Casino page sticky bottom bar * 2. Responsive Set Height * 3. KB ACCORDIONS * 4. LISTINGS SLIDER (Shortcode) * 5. Modeltheme Compare *-------------------------------------------------------------------*/ (function ($) { 'use strict'; jQuery( document ).ready(function() { // Casino page sticky bottom bar if (jQuery('.mt-sticky-listing-box').length) { jQuery(window).on( 'scroll', function(){ var sticky_panel = jQuery('.mt-sticky-listing-box'), scroll_top = jQuery(window).scrollTop(); if (scroll_top >= 350) { sticky_panel.addClass('visible-box'); }else { sticky_panel.removeClass('visible-box'); } }); } // Responsive Set Height jQuery(function() { if (jQuery('.archive .single-listing.list-view.listing-taxonomy').length){ if (jQuery("body").hasClass("archive")) { jQuery('.archive .single-listing.list-view.listing-taxonomy').matchHeight({ byRow: true }); } } if (jQuery('.listing-taxonomy .listings_custom').length){ if (jQuery("body").hasClass("page-template-template-reviews")) { jQuery('.listing-taxonomy .listings_custom').matchHeight({ byRow: true }); } } if (jQuery('.mt-reviews-grid .listings_custom').length){ jQuery('.mt-reviews-grid .listings_custom').matchHeight({ byRow: true }); } }); // KB ACCORDIONS function mtlistings_kb_accordion_toggles(){ jQuery('.knowledge-accordion .accordion li ul li.current_post:nth-child(1)').closest('ul').addClass('open'); jQuery('.knowledge-accordion .accordion li ul li.current_post:lt(1)').closest('ul').show(); jQuery('.knowledge-accordion .accordion li.current_post:lt').show(); //KB list accordion var Accordion = function(el, multiple) { this.el = el || {}; this.multiple = multiple || false; // Variables privadas var links = this.el.find('.link'); // Evento links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown) } Accordion.prototype.dropdown = function(e) { var $el = e.data.el, $this = jQuery(this), $next = $this.next(); $next.slideToggle(); $this.parent().toggleClass('open'); if (!e.data.multiple) { $el.find('.submenu').not($next).slideUp().parent().removeClass('open'); }; } var accordion = new Accordion(jQuery('#accordion'), false); } mtlistings_kb_accordion_toggles(); // LISTINGS SLIDER (Shortcode) jQuery(".listings-container-4").owlCarousel({ dots : true, autoPlay : false, slideSpeed : 700, paginationSpeed : 700, autoPlay : true, autoPlayTimeout:10000, autoPlayHoverPause:true, itemsCustom : [ [0, 1], [450, 2], [600, 2], [700, 3], [1000, 3], [1200, 4], [1400, 4], [1600, 4] ] }); jQuery(".listings-container-3").owlCarousel({ dots : true, autoPlay : false, slideSpeed : 700, paginationSpeed : 700, autoPlay : true, autoPlayTimeout:10000, autoPlayHoverPause:true, itemsCustom : [ [0, 1], [450, 2], [600, 2], [700, 2], [1000, 2], [1200, 3], [1400, 3], [1600, 3] ] }); jQuery(".listings-container-4").owlCarousel({ dots : true, autoPlay : false, slideSpeed : 700, paginationSpeed : 700, autoPlay : true, autoPlayTimeout:10000, autoPlayHoverPause:true, itemsCustom : [ [0, 1], [450, 2], [600, 2], [700, 3], [1000, 3], [1200, 4], [1400, 4], [1600, 4] ] }); jQuery(".listings-container-5").owlCarousel({ dots : true, autoPlay : false, slideSpeed : 700, paginationSpeed : 700, autoPlay : true, autoPlayTimeout:10000, autoPlayHoverPause:true, itemsCustom : [ [0, 1], [450, 2], [600, 2], [700, 3], [1000, 4], [1200, 4], [1400, 5], [1600, 5] ] }); //Modeltheme Compare function mtlistings_casino_compare(){ jQuery('.casino-compare-1, .casino-compare-2').on( "click", function() { var casino_side = jQuery(this).attr('data-side'); jQuery('.modal-casino-single').each(function(){ jQuery('.modal-casino-single').attr('data-side-dynamic', casino_side); jQuery('.modal-casino-single').removeClass('is-selected'); }); }); jQuery('.compare_table_section').show(function(){ jQuery('.how_works').hide(); }); jQuery('.modal-casino-single').each(function(){ jQuery(this).on( "click", function() { var casino_id = jQuery(this).attr('data-id'), casino_image_url = jQuery(this).find('img').attr('src'), casino_title = jQuery(this).find('img').attr('alt'), casino_side = jQuery(this).attr('data-side-dynamic'); // set is selected class jQuery(this).toggleClass('is-selected'); // Close Bootstrap modal setTimeout( function(){ jQuery('#embed-modal').modal('toggle'); }, 600 ); jQuery('.casino-compare-'+casino_side).find('input').val(casino_id); jQuery('.casino-compare-'+casino_side).find('h4').html(casino_title); jQuery('.casino-compare-'+casino_side).find('img').attr('src',casino_image_url); if (jQuery('.casino-compare-1 input').val() && jQuery('.casino-compare-2 input').val()) { jQuery('.button-compare').addClass('ready-for-submit').removeAttr('disabled'); } }); }); } mtlistings_casino_compare(); function mtlistings_star_ratings(){ if (jQuery('#mt-rating-stars-parent').length){ var stars_section = jQuery('#mt-rating-stars-parent').children('.mt-rating-stars'); for (j = 0; j < stars_section.length; j++) { jQuery('#mt-rating-stars-'+j+' #stars li').on('click', function(){ var onStar = parseInt(jQuery(this).data('value'), 10); var stars = jQuery(this).parent().children('li.star'); for (i = 0; i < stars.length; i++) { jQuery(stars[i]).removeClass('selected'); } for (i = 0; i < onStar; i++) { jQuery(stars[i]).addClass('selected'); } var ratingValue = parseInt(jQuery(this).parent().children('li.star.selected').last().data('value'), 10); jQuery(this).parent().parent().find('input').val(ratingValue); }); } } } mtlistings_star_ratings(); }); } (jQuery) );