add pipe nav

This commit is contained in:
2020-07-30 11:07:54 +02:00
parent 62e09ba0eb
commit fc54e18ab9
9 changed files with 201 additions and 14 deletions
+65 -6
View File
@@ -1,21 +1,65 @@
(function ($) {
function currenturl() {
$link.each(function(i){
var url = $(this).attr('href');
var current = window.location.pathname;
if (url == current) {
$(this).addClass('current');
$(this).parents('.navigation__item').addClass('current');
}
});
}
function notes() {
var $link = $('#presentation a');
var allNotes = $ ('.notes > div');
allNotes.hide();
$link.each(function(){
$(this).click(function(e) {
$this = $(this);
if ( $this.is('#ressource') || $this.is('#bibliographie') ) {
e.preventDefault();
var $url = $this.attr("href");
if ($( ".side_notes" )[0]) {
$( ".side_notes" ).fadeOut(200, function() {
$(this).remove();
});
} else if ($('.notes > div')[0]) {
$( ".notes > div" ).fadeOut(200);
}
content_type($url, $this);
ajax($url, $this);
} else if ($this.is('#note')) {
e.preventDefault();
var id_notes = $this.attr('href');
var notes = $(".notes "+id_notes);
if ($( ".side_notes" )[0]) {
$( ".side_notes" ).fadeOut(200, function() {
$(this).remove();
});
} else if ($('.notes > div')[0]) {
$( ".notes > div" ).fadeOut(200);
}
notes.fadeIn(200);
position_link($this, notes);
$(window).resize(function() {
position_link($this, notes);
});
close();
}
});
})
@@ -38,8 +82,10 @@
if ($this.is('#ressource')) {
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");
@@ -56,27 +102,40 @@
})
}
function position_link($this) {
function position_link($this, id_notes) {
var $top_link = $this.position().top;
var width = $(window).width();
console.log('$top_link',$top_link);
$('.side_notes').css("top", $top_link);
if ( $this.is('#ressource') || $this.is('#bibliographie') ) {
$('.side_notes').css("top", $top_link);
}
if ( $this.is('#note') ) {
id_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);
if ( $this.is('#ressource') || $this.is('#bibliographie') ) {
$('.side_notes').css("top", $top_link);
}
if ( $this.is('#note') ) {
id_notes.css("top", $top_link);
}
}
}
function close() {
var $croix = $('.side_notes .close');
var $croix = $('.close');
$croix.click(function(e) {
$(this).parents('.side_notes').fadeOut(200, function() {
$(this).remove();
});
$(this).parents('.notes > div').fadeOut(200);
});