/** * File customizer.js. * * Theme Customizer enhancements for a better user experience. */ ( function( $ ) { /* set same hights for items inside container */ /* you neet tu set this clases 1// .sameHeightContainer 2// .sameHeightItem *************************************************/ function maxHeight() { $('.sameHeightContainer').each(function(){ // 1 exception var highestBox = 0; $('.include', this).each(function(){ $(this).height('auto'); if($(this).height() > highestBox) { highestBox = $(this).height(); } }); $('.include',this).height(highestBox); // end 1 exception var highestBox = 0; $('.sameHeightItem', this).each(function(){ $(this).height('auto'); if($(this).height() > highestBox) { highestBox = $(this).height(); } }); $('.sameHeightItem',this).height(highestBox); }); }; $(document).ready(function() { maxHeight(); }) $(window).resize(function () { maxHeight(); }); /* end sameHeight */ /*start ecografie dopler unilateral bilateral*/ $('.ub-item').on('click', function(e) { $(this).parent().find('.ub-item').removeClass("ticked"); $(this).addClass("ticked"); $(this).parent().find('i').removeClass("fa-check"); $(this).find('i').addClass("fa-check"); var id_inv=$(this).attr('data-inv'); //console.log(id_inv) $(this).parents('.cardiocheck-price').find('.inv-link').attr("href", "/programare-online/?investigation="+id_inv);; e.preventDefault(); }); /*end ecografie dopler unilateral bilateral*/ } )( jQuery ); /* *********************************************************************** *************** medici page - filtering form ************************** ************************************************************************ */ function filter_doctors(element){ var dr_name=jQuery('#post_doctor').val(); dr_name = dr_name.toLowerCase(); var dr_investigation=jQuery('#post_investigation').val(); var dr_specialization=jQuery('#post_speciality').val(); if (dr_name == '') { dr_name = '#'; } //console.log(dr_name+'/'+dr_investigation+'/'+dr_specialization); jQuery('.doctor_item').each(function(){ if ( (jQuery(this).attr('data_name').indexOf(dr_name) > -1) && (jQuery(this).attr('data_investigation').indexOf(dr_investigation) > -1) && (jQuery(this).attr('data_specialization').indexOf(dr_specialization) > -1) ){ jQuery(this).show(); //console.log('show'); }else{ jQuery(this).hide(); //console.log('hide'); } }); } /* *********************************************************** ******************* multiple items carouselTestimonials******* ************************************************************* */ jQuery(document).ready(function($) { /* Carousel */ $('#carousel-doctor-list').on('slide.bs.carousel', function (e) { /* CC 2.0 License Iatek LLC 2018 Attribution required */ var $e = $(e.relatedTarget); var idx = $e.index(); var itemsPerSlide = 4; var totalItems = $('#carousel-doctor-list .carousel-item').length; if (idx >= totalItems-(itemsPerSlide-1)) { var it = itemsPerSlide - (totalItems - idx); for (var i=0; i lastScrollTop && st > navbarHeight){ // Scroll Down $('header').removeClass('nav-down').addClass('nav-up'); } else { // Scroll Up if(st + $(window).height() < $(document).height()) { $('header').removeClass('nav-up').addClass('nav-down'); } } lastScrollTop = st; } // end mobile header scroll var lastId, topMenu = $(".nav-preturi"), topMenuHeight = topMenu.outerHeight()+15, // All list items menuItems = topMenu.find("a"), // Anchors corresponding to menu items scrollItems = menuItems.map(function(){ var item = $($(this).attr("href")); if (item.length) { return item; } }); // Bind click handler to menu items // so we can get a fancy scroll animation /*menuItems.click(function(e){ var href = $(this).attr("href"), offsetTop = href === "#" ? 0 : $(href).offset().top-topMenuHeight+1; $('html, body').stop().animate({ scrollTop: offsetTop }, 300); e.preventDefault(); });*/ // Bind to scroll $(window).scroll(function(){ // Get container scroll position var fromTop = $(this).scrollTop()+topMenuHeight; // Get id of current scroll item var cur = scrollItems.map(function(){ if ($(this).offset().top < fromTop) return this; }); // Get the id of the current element cur = cur[cur.length-1]; var id = cur && cur.length ? cur[0].id : ""; if (lastId !== id) { lastId = id; // Set/remove active class menuItems .parent().removeClass("active") .end().filter("[href='#"+id+"']").parent().addClass("active"); } }); //active menu item, on scroll /* $(document).on("scroll", onScroll);*/ //smoothscroll /* $('a[href^="#"]').on('click', function (e) { e.preventDefault(); $(document).off("scroll"); $('a').each(function () { $(this).removeClass('active'); }) $(this).addClass('active'); var target = this.hash, menu = target; $target = $(target); $('html, body').stop().animate({ 'scrollTop': $target.offset().top+2 }, 500, 'swing', function () { window.location.hash = target; $(document).on("scroll", onScroll); }); }); */ }); /*function onScroll(event){ var scrollPos = jQuery(document).scrollTop(); jQuery('.nav-preturi a').each(function () { var currLink = jQuery(this); var refElement = jQuery(currLink.attr("href")); if (refElement.position().top <= scrollPos && refElement.position().top + refElement.height() > scrollPos) { jQuery('.nav-preturi ul li a').removeClass("active"); currLink.addClass("active"); } else{ currLink.removeClass("active"); } });*/