site.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. function map() {
  2. var $carte = $('#carte');
  3. if ( $carte.length ) {
  4. var mymap = L.map('carte').setView([44.7365818, 4.9776488], 13);
  5. var greenIcon = L.icon({
  6. iconUrl: '/user/themes/lecampus/images/mappoint.svg',
  7. iconSize: [38, 95], // size of the icon
  8. iconAnchor: [22, 94], // point of the icon which will correspond to marker's location
  9. popupAnchor: [-3, -76] // point from which the popup should open relative to the iconAnchor
  10. });
  11. L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
  12. maxZoom: 18,
  13. id: 'mapbox.streets'
  14. }).addTo(mymap);
  15. L.marker([44.7365818, 4.9776488], {icon: greenIcon}).addTo(mymap)
  16. .bindPopup("<b>Hello world!</b><br />I am le campus.").openPopup();
  17. function onMapClick(e) {
  18. popup
  19. .setLatLng(e.latlng)
  20. .setContent("You clicked the map at " + e.latlng.toString())
  21. .openOn(mymap);
  22. }
  23. mymap.on('click', onMapClick);
  24. }
  25. }
  26. function filteritem() {
  27. var $card = $('#item > .card');
  28. var $cat = $('.cat a');
  29. var $img = $('#item .img');
  30. $(".filters .btn").click(function(e) {
  31. e.preventDefault();
  32. var filter = $(this).attr("data-filter");
  33. var self = $('.container #item');
  34. self.masonryFilter({
  35. filter: function () {
  36. if (!filter) return true;
  37. return $(this).attr("data-filter") == filter;
  38. }
  39. });
  40. });
  41. var $grid = $('#archive #item, #calendrier #item').masonry({
  42. // columnWidth: 200,
  43. itemSelector: '.card',
  44. gutter: 10,
  45. transitionDuration: '0.2s'
  46. });
  47. // $( "a[hreflang|='en']" ).css( "border", "3px dotted green" );
  48. $grid.imagesLoaded().progress(function() {
  49. $grid.masonry();
  50. });
  51. }
  52. function slide() {
  53. $(".gal").slidesjs({
  54. width: 940,
  55. height: 528,
  56. pagination: {
  57. active: false
  58. }
  59. });
  60. }
  61. function links() {
  62. var $a = $('li a[href="/organisez-vos-evenements"],li a[href="/qui-sommes-nous"] ');
  63. var $map = $('a#carte');
  64. $a.on('click', function(e) {
  65. e.preventDefault();
  66. })
  67. $map.on('click', function(e) {
  68. e.preventDefault();
  69. })
  70. }
  71. jQuery(document).ready(function(){
  72. links();
  73. slide();
  74. filteritem();
  75. map();
  76. });