position ajax
This commit is contained in:
@@ -12,3 +12,14 @@ article img,
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layout-content > div{
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.side_notes{
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.side_notes > *{
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,34 +3,52 @@ function notes() {
|
|||||||
var $link = $('#presentation a');
|
var $link = $('#presentation a');
|
||||||
$link.each(function(){
|
$link.each(function(){
|
||||||
$(this).click(function(e) {
|
$(this).click(function(e) {
|
||||||
if ($(this).is('#ressource')) {
|
$this = $(this);
|
||||||
|
if ( $this.is('#ressource') || $this.is('#publication') ) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var $url = $(this).attr("href");
|
|
||||||
|
var $url = $this.attr("href");
|
||||||
|
|
||||||
if ($( ".side_notes" )[0]) {
|
if ($( ".side_notes" )[0]) {
|
||||||
$( ".side_notes" ).remove();
|
$( ".side_notes" ).remove();
|
||||||
}
|
}
|
||||||
|
content_type($url, $this);
|
||||||
$("<div class='side_notes'/>").insertAfter("article");
|
ajax($url, $this);
|
||||||
|
|
||||||
ajax($url);
|
|
||||||
}else{
|
|
||||||
// nothing
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
function ajax($url) {
|
function content_type($url, $this) {
|
||||||
|
if ($this.is('#ressource')) {
|
||||||
|
$("<div class='side_notes'><a href="+$url+"></a> </div>").insertAfter("article");
|
||||||
|
}else if ( $this.is('#publication') ) {
|
||||||
|
console.log('clcik');
|
||||||
|
$("<div class='side_notes'></>").insertAfter("article");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ajax($url , $this) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: $url,
|
url: $url,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
dataType:'html',
|
dataType:'html',
|
||||||
async: true,
|
async: true,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
if ($this.is('#ressource')) {
|
||||||
|
$(data).find('article > div:not(.__wrap_side) .__wrapper').appendTo('.side_notes a');
|
||||||
|
}else if ($this.is('#publication')) {
|
||||||
$(data).find('article > div:not(.__wrap_side) .__wrapper').appendTo('.side_notes');
|
$(data).find('article > div:not(.__wrap_side) .__wrapper').appendTo('.side_notes');
|
||||||
|
}
|
||||||
|
position_link($this);
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function position_link($this) {
|
||||||
|
var $top_link = $this.position().top;
|
||||||
|
console.log($top_link);
|
||||||
|
$('.side_notes > *').css("top", $top_link);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user