// B2C MODAL function b2c_modal(id_string) { $(id_string).fadeIn(300); $('html').addClass('b2c_modal_open'); } function b2c_modal_close(obj) { $('html').removeClass('b2c_modal_open'); $(obj).closest('.b2c_modal_wrapper').addClass('b2c_modal_anim').fadeOut(300, function() { $(obj).closest('.b2c_modal_wrapper').removeClass('b2c_modal_anim'); }); } $('.b2c_compare_popup_close').click(function() { b2c_modal_close(this); return false; }); $('.b2c_compare_popup_overflow').click(function(e) { if (!$(e.target).is(".b2c_compare_popup_inner, .b2c_compare_popup_inner *")) { b2c_modal_close(this); } }); $('.b2c_compare_table thead').each(function(index, el) { }); // DOM READY (function() { var ww = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; // PLANS SLIDER var b2c_plans_slider = $('.b2c_plans_listing_slider .owl-carousel'); if (b2c_plans_slider.length) { b2c_plans_slider.owlCarousel({ items: 1, nav: false, navElement: 'div', navText: ['', ''], dots: false, touchDrag: false, autoWidth: true, mouseDrag: false, responsive: { 580: { items: 2, nav: true, autoWidth: false }, 991: { items: 3, nav: true, autoWidth: false }, 1200: { items: 4, nav: true, autoWidth: false } } }); setTimeout(function() { b2c_plans_slider.trigger('refresh.owl.carousel'); }, 500); } b2c_plans_slider.parent().find('.owl-dot').click(function(){b2c_plans_slider.trigger('to.owl.carousel', [$(this).index(), 300]);}); $('.b2c_plan_item_inner').click(function(e) { if (ww > 580) { var getcls = $(this).attr('class'); $(this).closest('.owl-item').addClass('selected').siblings().removeClass('selected'); $(this).find('.b2c_plan_buttons').fadeIn(200).closest('.owl-item').siblings().find('.b2c_plan_buttons').fadeOut(200); return false; } }); $('.b2c_plan_item_inner input').click(function(e) { e.stopPropagation(); }); /* ACCORDION SLIDE SCRIPT */ $(document).on("click", ".custom_accordionTitle", function() { $(this).parent('.custom_accordionItem').siblings().removeClass('active').find('.custom_accordionContent').slideUp('fast'); $(this).parent('.custom_accordionItem').toggleClass('active'); $(this).next('.custom_accordionContent').slideToggle('fast'); return false; }); // numbers only $(".only_numbers").on('keyup keypress', function(e) { var o,v=(o=$(this)).val(); o.val(v.replace(/[^\d]/g,"")); if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) { return false; } }); $(".b2c_plans_duration_select").click(function() { selectCarousel(); }) selectCarousel(); // document click events $(document).click(function(event) { // code }); })(); $('#detailsCategory').click(function(event) { $('#details_category').modal('show'); return false; }); $('.b2c_details_category_popup_close').click(function() { $('#details_category').modal('hide'); return false; }); function compareBenefit(planId) { var plans = ''; $.each($('.collectPlanId'), function(){ plans=plans + $(this).val() + ','; }); plans = plans.substring(0, plans.length - 1); $.ajax({ url : '/blocks/category/plan/comparePlanBenefitJson.jsp', async : true, dataType: 'html', data: {'planId': planId, 'plans': plans}, success : function(data) { $(".b2c_compare_popup_content").html(data); }, error : function() { console.log('error'); } }); b2c_modal('#b2c_modal_compare'); return false; }; function selectCarousel() { $(".b2c_plans_listing_slider > *").hide(); var duration = $("select.b2c_plans_duration_select option:selected").val(); $("#carousel-" + duration).show() }