ajax_notes
This commit is contained in:
@@ -6,11 +6,13 @@
|
||||
$link.each(function(){
|
||||
$(this).click(function(e) {
|
||||
$this = $(this);
|
||||
if ( $this.is('#ressource') || $this.is('#publication') ) {
|
||||
if ( $this.is('#ressource') || $this.is('#bibliographie') ) {
|
||||
e.preventDefault();
|
||||
var $url = $this.attr("href");
|
||||
if ($( ".side_notes" )[0]) {
|
||||
$( ".side_notes" ).remove();
|
||||
$( ".side_notes" ).fadeOut(200, function() {
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
content_type($url, $this);
|
||||
ajax($url, $this);
|
||||
@@ -20,35 +22,66 @@
|
||||
|
||||
function content_type($url, $this) {
|
||||
if ($this.is('#ressource')) {
|
||||
$("<div class='side_notes'><a href="+$url+"></a> </div>").insertAfter(".__wrap_side article");
|
||||
}else if ( $this.is('#publication') ) {
|
||||
console.log('clcik');
|
||||
$("<div class='side_notes'></>").insertAfter(".__wrap_side article");
|
||||
$("<div class='side_notes'><div class='wrap'><a href="+$url+"></a></div> </div>").insertAfter(".__wrap_side article");
|
||||
} else if ( $this.is('#bibliographie') ) {
|
||||
$("<div class='side_notes'><div class='wrap'></div></>").insertAfter(".__wrap_side article");
|
||||
}
|
||||
}
|
||||
|
||||
function ajax($url , $this) {
|
||||
$.ajax({
|
||||
url: $url,
|
||||
url: $url + '#publicationAjax',
|
||||
method: "GET",
|
||||
dataType:'html',
|
||||
dataType:'text',
|
||||
async: true,
|
||||
success: function(data) {
|
||||
if ($this.is('#ressource')) {
|
||||
$(data).find('article.publications .__wrapper').appendTo('.side_notes a');
|
||||
}else if ($this.is('#publication')) {
|
||||
$(data).find('article.publications .__wrapper').appendTo('.side_notes');
|
||||
var hero = 'article .__wrapper .__hero';
|
||||
var head = 'article .__wrapper .__head';
|
||||
$(data).find(hero +','+ head).appendTo('.side_notes > div a').hide().fadeIn(200);
|
||||
$("<div class='close'></div>").appendTo(".side_notes > div");
|
||||
}else if ($this.is('#bibliographie')) {
|
||||
$(data).find('article.bibliographie').appendTo('.side_notes > div');
|
||||
$("<div class='close'></div>").appendTo(".side_notes > div");
|
||||
}
|
||||
|
||||
position_link($this);
|
||||
$(window).resize(function() {
|
||||
position_link($this);
|
||||
});
|
||||
|
||||
close();
|
||||
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function position_link($this) {
|
||||
var $top_link = $this.position().top;
|
||||
console.log($top_link);
|
||||
$('.side_notes > *').css("top", $top_link);
|
||||
var width = $(window).width();
|
||||
|
||||
console.log('$top_link',$top_link);
|
||||
$('.side_notes').css("top", $top_link);
|
||||
|
||||
if (width <= '754') {
|
||||
var $top_link = $this.offset().top;
|
||||
console.log('$top_link',$top_link);
|
||||
$('.side_notes').css("top", $top_link);
|
||||
}
|
||||
}
|
||||
|
||||
function close() {
|
||||
var $croix = $('.side_notes .close');
|
||||
$croix.click(function(e) {
|
||||
|
||||
$(this).parents('.side_notes').fadeOut(200, function() {
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function slide() {
|
||||
@@ -69,8 +102,6 @@
|
||||
date;
|
||||
var $cells = this.cells;
|
||||
|
||||
// console.log('$cells',$cells);
|
||||
|
||||
$('.__slide article.programme[data-date]').each(function(i, el){
|
||||
date = $(el).data('date');
|
||||
|
||||
@@ -83,26 +114,10 @@
|
||||
$(this).addClass('first');
|
||||
var dateValue = $(this).data('date');
|
||||
console.log('dateValue',dateValue);
|
||||
// $(this).html(dateValue );
|
||||
$("<span>"+dateValue+"</span>").prependTo($(this));
|
||||
}
|
||||
});
|
||||
|
||||
// var date = this.cells.element.dataset.date;
|
||||
// var date = this.cells;
|
||||
// for (var i = 0; i < date.length; i++) {
|
||||
// console.log("cc",date[i].element.dataset.date);
|
||||
// $head_date.append( "<div>"+date[i].element.dataset.date+"</div>" );
|
||||
// }
|
||||
},
|
||||
// change: function(index, e) {
|
||||
// var date_change = this.cells[index].element.dataset.date;
|
||||
//
|
||||
// if ($head_date.html() != date_change) {
|
||||
// $head_date.html( "<div>"+date_change+"</div>" );
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -130,14 +145,6 @@
|
||||
})
|
||||
});
|
||||
|
||||
// function date() {
|
||||
// var thumbnails = $('.__slide article.programme');
|
||||
// $.each(thumbnails, function(i){
|
||||
// date = thumbnails[i].dataset.date;
|
||||
// })
|
||||
// }
|
||||
// date();
|
||||
|
||||
}
|
||||
|
||||
function burger() {
|
||||
|
||||
Reference in New Issue
Block a user