responsive
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,51 @@
|
||||
/* -- Filter Plugin -- */
|
||||
(function ($) {
|
||||
'use strict';
|
||||
$.fn.masonryFilter = function (options) {
|
||||
//reload masonry
|
||||
var reload = function ($container) {
|
||||
setTimeout(function () {
|
||||
$container.masonry("layout");
|
||||
}, 100);
|
||||
};
|
||||
|
||||
var process = function ($container) {
|
||||
var items = $container.masonry("getAllItems"),
|
||||
revealItems = [],
|
||||
hideItems = [];
|
||||
|
||||
$.each(items, function(i) {
|
||||
var item = items[i];
|
||||
var elm = $(item.element),
|
||||
shouldShow = options.filter && options.filter.call(elm);
|
||||
|
||||
if (shouldShow) {
|
||||
if (item.isHidden) {
|
||||
// -- Have to set this property so masonry does
|
||||
// not include hidden items when calling "layout"
|
||||
item.isIgnored = false;
|
||||
revealItems.push(item);
|
||||
}
|
||||
} else {
|
||||
if (!item.isHidden) {
|
||||
// -- Easier to set this property directy rather than
|
||||
// using the "ignore" method, as it takes in a DOM
|
||||
// element rather than the masonry item object.
|
||||
item.isIgnored = true;
|
||||
hideItems.push(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$container.masonry('hide', hideItems);
|
||||
$container.masonry('reveal', revealItems);
|
||||
|
||||
reload($container);
|
||||
};
|
||||
|
||||
return this.each(function () {
|
||||
var self = $(this);
|
||||
process(self);
|
||||
});
|
||||
};
|
||||
}(window.jQuery));
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,97 @@
|
||||
(function($){
|
||||
'use strict';
|
||||
$.fn.multipleFilterMasonry = function(options){
|
||||
var cache=[];
|
||||
var filters = [];
|
||||
|
||||
if(options.selectorType === 'list') {
|
||||
$(options.filtersGroupSelector).children().each(function() {
|
||||
filters.push($(this).data('filter'));
|
||||
});
|
||||
}
|
||||
|
||||
//the main job of the function is to cache the item,because we are going to filter the items later
|
||||
var init = function($container){
|
||||
$container.find(options.itemSelector).each(function(){
|
||||
cache.push($(this));
|
||||
});
|
||||
$container.masonry(options);
|
||||
};
|
||||
|
||||
//filter items in cache
|
||||
var filterItems = function(selector){
|
||||
var result=[];
|
||||
$(cache).each(function(item){
|
||||
$(selector).each(function(index,sel) {
|
||||
if(cache[item].is(sel)){
|
||||
if($.inArray(cache[item], result) === -1) result.push(cache[item]);
|
||||
}
|
||||
});
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
//reload masonry
|
||||
var reload = function($container,items){
|
||||
$container.empty();
|
||||
$(items).each(function(){
|
||||
$($container).append($(this));
|
||||
});
|
||||
$container.masonry('reloadItems');
|
||||
$container.masonry();
|
||||
};
|
||||
|
||||
// Hash filter
|
||||
var hashFilter = function($container) {
|
||||
var hash = window.location.hash.replace("#", "");
|
||||
if($.inArray(hash, filters) !== -1) {
|
||||
reload($container, $('.' + hash));
|
||||
}
|
||||
};
|
||||
|
||||
var proc = function($container){
|
||||
$(options.filtersGroupSelector).find('input[type=checkbox]').each(function(){
|
||||
$(this).change(function(){
|
||||
var selector = [];
|
||||
$(options.filtersGroupSelector).find('input[type=checkbox]').each( function() {
|
||||
if ( $(this).is(':checked') ) {
|
||||
selector.push( '.' + $(this).val() );
|
||||
}
|
||||
});
|
||||
var items = cache;
|
||||
if (selector.length > 0) {
|
||||
items = filterItems(selector);
|
||||
}
|
||||
reload($container,items);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var procUL = function($container){
|
||||
$(options.filtersGroupSelector).children().each(function(){
|
||||
$(this).click(function(){
|
||||
$(options.filtersGroupSelector).children().removeClass('selected');
|
||||
window.location.hash = $(this).data('filter');
|
||||
var selector = [];
|
||||
selector.push( '.' + $(this).data('filter') );
|
||||
$(this).addClass('selected');
|
||||
var items = cache;
|
||||
if (selector.length > 0) {
|
||||
items = filterItems(selector);
|
||||
}
|
||||
reload($container,items);
|
||||
});
|
||||
});
|
||||
|
||||
hashFilter($container);
|
||||
$(options.filtersGroupSelector).children().removeClass('selected');
|
||||
$('.filters li[data-filter='+window.location.hash.replace("#", "")+']').addClass('selected');
|
||||
};
|
||||
|
||||
return this.each(function() {
|
||||
var $$ = $(this);
|
||||
init($$);
|
||||
options.selectorType === 'list' ? procUL($$) : proc($$);
|
||||
});
|
||||
};
|
||||
}(window.jQuery));
|
||||
@@ -0,0 +1,160 @@
|
||||
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("<b>Hello world!</b><br />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({
|
||||
responsive: true,
|
||||
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');
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function mapsalles() {
|
||||
var $salles = $('.fond svg path');
|
||||
var $content = $('.content .content_salle');
|
||||
arrayid = [];
|
||||
|
||||
$salles.on('click', function() {
|
||||
var idsalle = this.id;
|
||||
arrayid.push(idsalle);
|
||||
$salles.css("fill", "white");
|
||||
$(this).css("fill", "#0093a3");
|
||||
$('.content .content_salle').css("display", "none");
|
||||
$('.content .content_salle#'+arrayid).css("display", "block");
|
||||
arrayid.length = 0;
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
function burger() {
|
||||
$('.navTrigger').click(function(){
|
||||
$(this).toggleClass('active');
|
||||
$('.dropmenu').toggleClass('active');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
addclass();
|
||||
clickbutton();
|
||||
links();
|
||||
slide();
|
||||
filteritem();
|
||||
map();
|
||||
mapsalles();
|
||||
burger();
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
function map(){if($("#carte").length){var e=L.map("carte").setView([44.7365818,4.9776488],13),t=L.icon({iconUrl:"/user/themes/lecampus/images/mappoint.svg",iconSize:[38,95],iconAnchor:[22,94],popupAnchor:[-3,-76]});L.tileLayer("https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw",{maxZoom:18,id:"mapbox.streets"}).addTo(e),L.marker([44.7365818,4.9776488],{icon:t}).addTo(e).bindPopup("<b>Hello world!</b><br />I am le campus.").openPopup(),e.on("click",function(t){popup.setLatLng(t.latlng).setContent("You clicked the map at "+t.latlng.toString()).openOn(e)})}}function filteritem(){$(".body-wrapper > .card"),$(".cat a"),$(".body-wrapper .img");$(".filters .btn").click(function(e){e.preventDefault();var t=$(this).attr("data-filter");$(".body-wrapper").masonryFilter({filter:function(){return!t||$(this).attr("data-filter")==t}})});var e=$("#archive .body-wrapper, #calendrier .body-wrapper").masonry({itemSelector:".card",gutter:10,transitionDuration:"0.2s"});e.imagesLoaded().progress(function(){e.masonry()})}function slide(){$(".gal").bxSlider({infiniteLoop:!0,preloadImages:"visible",pager:!1,auto:!0})}function links(){var e=$('li a[href="/organisez-vos-evenements"],li a[href="/qui-sommes-nous"] '),t=$("a#carte");e.on("click",function(e){e.preventDefault()}),t.on("click",function(e){e.preventDefault()})}function clickbutton(){$("#ajax-test-form .radio").on("click",function(){$(this).parent(".form-data").find(".check").removeClass("check"),$(this).addClass("check")})}function clicksenddevis(){var e=$(".ok");$("#send-valide");e.on("click",function(){$(this).parent("#send-valide").remove()})}function addclass(){$("a#carte").parents(".content_s").addClass("map");var e=$("#reco .title"),t=$("#reco .txt");e.on("click",function(){t.toggleClass("open"),$(this).toggleClass("open")})}jQuery(document).ready(function(){addclass(),clickbutton(),links(),slide(),filteritem(),map()});
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user