123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- function notes() {
- var $link = $('#presentation a');
- $link.each(function(){
- $(this).click(function(e) {
- $this = $(this);
- if ( $this.is('#ressource') || $this.is('#publication') ) {
- e.preventDefault();
- var $url = $this.attr("href");
- if ($( ".side_notes" )[0]) {
- $( ".side_notes" ).remove();
- }
- content_type($url, $this);
- ajax($url, $this);
- }
- });
- })
- 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({
- url: $url,
- method: "GET",
- dataType:'html',
- async: true,
- 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');
- }
- position_link($this);
- },
- })
- }
- function position_link($this) {
- var $top_link = $this.position().top;
- console.log($top_link);
- $('.side_notes > *').css("top", $top_link);
- }
- }
- function slide() {
- var $slide = $('main .__slide');
- $slide.each(function() {
- $(this).flickity({
- cellAlign: 'left',
- pageDots: false,
- contain: true
- })
- });
- var $footer_slide = $('footer .__slide');
- $footer_slide.each(function() {
- $(this).flickity({
- cellAlign: 'left',
- pageDots: false,
- autoPlay: true,
- pauseAutoPlayOnHover: false,
- contain: true,
- prevNextButtons: false,
- })
- });
- }
- function burger() {
- var hamburgers = document.querySelector(".hamburger");
- var nav = document.querySelector(".nav-main");
- hamburgers.addEventListener("click", function() {
- this.classList.toggle("is-active");
- nav.classList.toggle("is-active");
- $('html, body').toggleClass("is-active");
- $('#block-popsu-colloque-branding').toggleClass("is-active");
- });
- }
- $( document ).ready(function() {
- notes();
- slide();
- burger();
- });
|