$(document).ready(function() { if (!Modernizr.svg) { var logo = $('.logo img[data-fallback]'); logo.attr('src', logo.data('fallback')); var push = $('.section-inscription img[data-fallback]'); push.attr('src', push.data('fallback')); } $('[data-toggle="tooltip"]').tooltip(); $('.btn-menu').click(function() { $('[role=navigation]').toggleClass('is-open'); }); $('html').click(function() { $('#select-pays .dropdown').hide(); }); $('#select-pays .dropdown').hide(); $('#select-pays > a').click(function(event){ $('#select-pays .dropdown').show(); event.stopPropagation(); }); $('.bouton-follow-active').mouseover(function(){ $(this).addClass('hover').text('Se désabonner').attr('data-icon', '5'); }).mouseout(function(){ $(this).removeClass('hover').text('Abonné').attr('data-icon', '6'); }); $('.search-action-collapse').click(function(){ console.log($(this)); $('.search-collapse').toggleClass('is-open'); }); // DATA-TOGGLE=TABS $tabs = $("[data-toggle=tabs]"); $('.nav li:first a', $tabs).addClass('is-active'); $('.content', $tabs).addClass('is-hide').first().removeClass('is-hide').addClass('is-show'); $('.nav a', $tabs).click(function() { $content = $('.content[data-tab=' + $(this).attr('data-tab') + ']', $tabs); if ($content.hasClass('is-hide')) { $('.nav a', $tabs).removeClass('is-active'); $(this).addClass('is-active'); $('.content', $tabs).addClass('is-hide').removeClass('is-show'); $content.addClass('is-show').removeClass('is-hide'); } return false; }); // DATA-TOGGLE=TABS-content $tabsContent = $("[data-toggle=tabs-content]"); $('.nav li:first a', $tabsContent).addClass('is-active'); $('.content', $tabsContent).addClass('is-hide').first().removeClass('is-hide').addClass('is-show'); $('.nav a', $tabsContent).click(function() { $content2 = $('.content[data-tab=' + $(this).attr('data-tab') + ']', $tabsContent); if ($content2.hasClass('is-hide')) { $('.nav a', $tabsContent).removeClass('is-active'); $(this).addClass('is-active'); $('.content', $tabsContent).addClass('is-hide').removeClass('is-show'); $content2.addClass('is-show').removeClass('is-hide'); } return false; }); $(".section-recherche-avancee select").select2({ placeholder: "Sélectionnez", allowClear: true, width: 500, minimumResultsForSearch: 20 }); $notation = $(".notes-echelle"); $("input", $notation).click(function() { $(this).parent().parent().find('li').removeClass('active'); $(this).parent().addClass("active").prevAll().addClass('active'); }); $("label", $notation).hover(function() { $(this).parent().addClass("hover").prevAll().addClass('hover'); }, function() { $(this).parent().parent().find('li').removeClass('hover'); }); var nbitemcarousel = $('.carousel-item').length; //alert(nbitemcarousel); $('.carousel-container').width(150 * nbitemcarousel + 5); $(function() { setInterval(function() { $(".carousel-container").animate({marginLeft: -150}, 800, function() { $(this).css({marginLeft: 0}).find("img:last").after($(this).find("img:first")); }) }, 3500); }); $('a.alert-cookie-link').click(function() { $.get("/remote/cookie-cnil.php", function(){ $('div.alert.alert-info.alert-cookie').hide(); }); }); //tri des listes d'avis $('select.liste-avis').change(function(){ $('div.liste-avis').load( "/includes/listeavis.php?type="+$(this).attr("name")+"&tri="+$("select.liste-avis option:selected").val()+"&link-data-id="+$(this).attr("link-data-id") ); }); //tri des classements entreprise $('select.liste-classement').change(function(){ var pathname = window.location.pathname; window.location = pathname+"?tri="+$("select.liste-classement option:selected").val(); }); $("input[type=file]").jfilestyle({buttonText: "Parcourir"}); });