Files
Popsu-coloque/web/themes/custom/popsu_colloque/js/script.js
T
2020-07-06 13:06:35 +02:00

39 lines
760 B
JavaScript

function notes() {
var $link = $('#presentation a');
$link.each(function(){
$(this).click(function(e) {
if ($(this).is('#ressource')) {
e.preventDefault();
var $url = $(this).attr("href");
if ($( ".side_notes" )[0]) {
$( ".side_notes" ).remove();
}
$("<div class='side_notes'/>").insertAfter("article");
ajax($url);
}else{
// nothing
}
});
})
function ajax($url) {
$.ajax({
url: $url,
method: "GET",
dataType:'html',
async: true,
success: function(data) {
$(data).find('article > div:not(.__wrap_side) .__wrapper').appendTo('.side_notes');
},
})
}
}
$( document ).ready(function() {
notes();
});