function map() { var $carte = $('#carte'); if ( $carte.length ) { var mymap = L.map('carte').setView([44.7365818, 4.9776488], 13); var greenIcon = L.icon({ iconUrl: '/user/themes/lecampus/images/mappoint.svg', iconSize: [38, 95], // size of the icon iconAnchor: [22, 94], // point of the icon which will correspond to marker's location popupAnchor: [-3, -76] // point from which the popup should open relative to the iconAnchor }); L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', { maxZoom: 18, id: 'mapbox.streets' }).addTo(mymap); L.marker([44.7365818, 4.9776488], {icon: greenIcon}).addTo(mymap) .bindPopup("Hello world!
I am le campus.").openPopup(); function onMapClick(e) { popup .setLatLng(e.latlng) .setContent("You clicked the map at " + e.latlng.toString()) .openOn(mymap); } mymap.on('click', onMapClick); } } function filteritem() { var $card = $('.body-wrapper > .card'); var $cat = $('.cat a'); var $img = $('.body-wrapper .img'); $(".filters .btn").click(function(e) { e.preventDefault(); var filter = $(this).attr("data-filter"); var self = $('.body-wrapper'); self.masonryFilter({ filter: function () { if (!filter) return true; return $(this).attr("data-filter") == filter; } }); }); var $grid = $('#archive .body-wrapper, #calendrier .body-wrapper').masonry({ // columnWidth: 200, itemSelector: '.card', gutter: 10, transitionDuration: '0.2s' }); // $( "a[hreflang|='en']" ).css( "border", "3px dotted green" ); $grid.imagesLoaded().progress(function() { $grid.masonry(); }); } function slide() { $('.gal').bxSlider({ infiniteLoop: true, preloadImages:'visible', pager:false, auto:true, }); } function links() { var $a = $('li a[href="/organisez-vos-evenements"],li a[href="/qui-sommes-nous"] '); var $map = $('a#carte'); $a.on('click', function(e) { e.preventDefault(); }) $map.on('click', function(e) { e.preventDefault(); }) } function clickbutton() { var $button = $('#ajax-test-form .radio'); $button.on('click', function(){ $(this).parent('.form-data').find('.check').removeClass('check'); $(this).addClass('check'); }); } function clicksenddevis() { var $ok = $('.ok'); var $send = $('#send-valide'); $ok.on('click', function () { $(this).parent('#send-valide').remove(); }) } function addclass() { var $map = $('a#carte'); $map.parents('.content_s').addClass('map') var $reco_click = $('#reco .title'); var $reco_txt = $('#reco .txt'); $reco_click.on('click', function() { $reco_txt.toggleClass('open'); $(this).toggleClass('open'); }) } jQuery(document).ready(function(){ addclass(); clickbutton(); links(); slide(); filteritem(); map(); });