/** * Gestion des publications (ouverture en volet) */ (function($, Drupal) { 'use strict'; $(function(){ console.log('publication.js : dom is ready',$('.open_volet').length); var current_url = window.location.href; // Open the sidebar $(document).on('click','.open_volet',function(e){ e.preventDefault(); $('.volet').html(''); var url = $(this).attr('href'); $.get( url, function( data ) { var publication_content = $('#content',data); $('.volet').html( publication_content); $('.volet').append('
'); window.history.pushState({},"", url); }); $('.volet').animate({right:0}); $('.volet-wrapper').addClass('show'); }); // Close the sidebar $(document).on('click','.volet-wrapper',function(e){ var space_right = '-70%'; if($(window).width() < 990) space_right = '-105%'; $('.volet-wrapper').removeClass('show'); $('.volet').animate({right:space_right}); window.history.pushState({},"", current_url); }); $('.volet').on('click', '.close_volet', function(){ var space_right = '-70%'; if($(window).width() < 990) space_right = '-105%'; $('.volet-wrapper').removeClass('show'); $('.volet').animate({right:space_right}); window.history.pushState({},"", current_url); }); }); })(jQuery, Drupal);