From 6d57f8a0883d97a84421818301684791829c4f3a Mon Sep 17 00:00:00 2001 From: Bachir Soussi Chiadmi Date: Tue, 4 Apr 2017 11:04:55 +0200 Subject: [PATCH] added autoscroll --- .../figureslibres/clameurs/js/dist/script.min.js | 2 +- .../all/themes/figureslibres/clameurs/js/script.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sites/all/themes/figureslibres/clameurs/js/dist/script.min.js b/sites/all/themes/figureslibres/clameurs/js/dist/script.min.js index ae22c9e5..37fcc1ca 100755 --- a/sites/all/themes/figureslibres/clameurs/js/dist/script.min.js +++ b/sites/all/themes/figureslibres/clameurs/js/dist/script.min.js @@ -1,3 +1,3 @@ (function($){Drupal.behaviors.init_theme=function(context){$('#messages-and-help > div.messages:not(.processed)').addClass('processed').each(function(){if($('a',this).size()||$(this).is('.error')||$(this).is('.warning')||$(this).text().length>100){$(this).prepend("X");$('span.close',this).click(function(){$(this).parent().slideUp('fast');});} -else{$(this).animate({opacity:1},5000,'linear',function(){$(this).slideUp('fast');});}});};function init(){console.log('Clameurs Theme');initHeaderAnime();};function initHeaderAnime(){var $header=$('#header a'),header_height=$header.height(),$slogan=$('#header h2'),fontsize=parseInt($slogan.css('font-size')),tmpfs,scrolltop,limit=300;console.log('font-size',fontsize);$(window).on('scroll',function(event){scrolltop=limit-$(this).scrollTop()*.5;scrolltop=Math.max(limit*0.35,scrolltop);alpha=scrolltop/limit;console.log('scrolltop '+scrolltop+' | allpha '+alpha);$header.height(header_height*alpha);tmpfs=fontsize*alpha;$slogan.css('font-size',tmpfs+"px");});};init();})(jQuery); \ No newline at end of file +else{$(this).animate({opacity:1},5000,'linear',function(){$(this).slideUp('fast');});}});};function init(){console.log('Clameurs Theme');initHeaderAnime();initAutoScroll();};function initHeaderAnime(){var $header=$('#header a'),header_height=$header.height(),$slogan=$('#header h2'),fontsize=parseInt($slogan.css('font-size')),tmpfs,scrolltop,limit=300;console.log('font-size',fontsize);$(window).on('scroll',function(event){scrolltop=limit-$(this).scrollTop()*.5;scrolltop=Math.max(limit*0.35,scrolltop);alpha=scrolltop/limit;console.log('scrolltop '+scrolltop+' | allpha '+alpha);$header.height(header_height*alpha);tmpfs=fontsize*alpha;$slogan.css('font-size',tmpfs+"px");});};function initAutoScroll(){console.log('initAutoScroll');var anchor=$('a.anchor.publie',"#thematique-anchor-links").last().attr('href');console.log(anchor);(function(anchor){setTimeout(function(){console.log('Timeout');window.location.href=anchor;},1000);})(anchor);};init();})(jQuery); \ No newline at end of file diff --git a/sites/all/themes/figureslibres/clameurs/js/script.js b/sites/all/themes/figureslibres/clameurs/js/script.js index 010680c5..fd956568 100755 --- a/sites/all/themes/figureslibres/clameurs/js/script.js +++ b/sites/all/themes/figureslibres/clameurs/js/script.js @@ -28,6 +28,7 @@ function init(){ console.log('Clameurs Theme'); initHeaderAnime(); + initAutoScroll(); }; function initHeaderAnime(){ @@ -53,6 +54,19 @@ }); }; + function initAutoScroll(){ + console.log('initAutoScroll'); + var anchor = $('a.anchor.publie', "#thematique-anchor-links").last().attr('href'); + console.log(anchor); + (function(anchor){ + setTimeout(function(){ + console.log('Timeout'); + window.location.href = anchor; + }, 1000); + })(anchor); + + }; + init(); })(jQuery);