started fixed header, fixed anchor links with fixed header

This commit is contained in:
2017-02-27 16:23:12 +01:00
parent b38c8e71d1
commit f8417f3db2
9 changed files with 109 additions and 35 deletions
@@ -3,7 +3,7 @@
Clameurs = function(){ Clameurs = function(){
function init(){ function init(){
console.log("Clameurs"); console.log("Clameurs Mod");
initVideoEvents(); initVideoEvents();
} }
@@ -156,7 +156,7 @@ function _clameursmod_thematiques_anchor_links(){
foreach ($nids as $nid) { foreach ($nids as $nid) {
$node = node_load($nid); $node = node_load($nid);
// dsm($node); // dsm($node);
$alias = drupal_get_path_alias('node/'.$nid); $alias = str_replace('/', '-', drupal_get_path_alias('node/'.$nid));
// get the workflow state ID // get the workflow state ID
$current_state = workflow_state_load_single($node->workflow); $current_state = workflow_state_load_single($node->workflow);
// dsm($current_state, 'current_state'); // dsm($current_state, 'current_state');
+35 -14
View File
@@ -40,20 +40,37 @@ input {
width: 1024px; width: 1024px;
margin: 0 auto; } margin: 0 auto; }
#header h1 a { #header {
display: block; position: fixed;
height: 335px; width: 100%;
background-image: url(../../images/logo.png); max-height: 400px;
background-size: contain; z-index: 20;
background-position: center; background-color: rgba(255, 255, 255, 0.9); }
background-repeat: no-repeat; #header hgroup.logo {
text-indent: -2000px; width: 1024px;
overflow: hidden; margin: 0 auto;
margin: 0; } padding: 1em 0; }
#header h1 {
margin: 0; }
#header h1 a {
display: block;
height: 335px;
background-image: url(../../images/logo.png);
background-size: contain;
background-position: center;
background-repeat: no-repeat;
text-indent: -2000px;
overflow: hidden;
margin: 0; }
#header h2 {
text-align: center;
color: #20c498; }
#header h2 { #main {
text-align: center; padding-top: 400px; }
color: #20c498; } #main > .region {
width: 1024px;
margin: 0 auto; }
#node-63 { #node-63 {
padding: 1em 0; } padding: 1em 0; }
@@ -267,7 +284,11 @@ body,
.node-thematique > h2 { .node-thematique > h2 {
font-size: 3em; font-size: 3em;
font-weight: 400; font-weight: 400;
padding-left: 0.18em; } padding-left: 0.18em;
position: relative; }
.node-thematique > h2 span {
position: absolute;
top: -177px; }
.node-thematique .content { .node-thematique .content {
letter-spacing: -0.25em; } letter-spacing: -0.25em; }
.node-thematique .content .field-name-field-emvideo img { .node-thematique .content .field-name-field-emvideo img {
@@ -49,15 +49,30 @@ body{
} }
@mixin main_centred(){
width:1024px; margin:0 auto;
}
#container{ #container{
width:1024px; margin:0 auto; width:1024px; margin:0 auto;
// overflow-x: visible; // overflow-x: visible;
} }
$header_height:400px;
#header{ #header{
position: fixed;
width:100%; max-height: $header_height;
z-index: 20;
background-color: transparentize(#fff, 0.1);
hgroup.logo{
@include main_centred();
padding: 1em 0;
}
h1{margin:0;}
h1 a{ h1 a{
display:block; display:block;
height:335px; height:335px;
// transition: height 0.1s ease-in-out;
background-image: url(../../images/logo.png); background-image: url(../../images/logo.png);
background-size: contain; background-size: contain;
background-position: center; background-position: center;
@@ -72,6 +87,13 @@ body{
} }
} }
#main{
padding-top: $header_height;
>.region{
@include main_centred();
}
}
// about // about
#node-63{ #node-63{
// color:$bleu; // color:$bleu;
@@ -268,6 +290,11 @@ body,
font-size: 3em; font-size: 3em;
font-weight: 400; font-weight: 400;
padding-left: 0.18em; padding-left: 0.18em;
position:relative;
span{
position: absolute;
top:-177px;
}
} }
.content{ .content{
@@ -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("<span class='close'>X</span>");$('span.close',this).click(function(){$(this).parent().slideUp('fast');});} (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("<span class='close'>X</span>");$('span.close',this).click(function(){$(this).parent().slideUp('fast');});}
else{$(this).animate({opacity:1},5000,'linear',function(){$(this).slideUp('fast');});}});};})(jQuery); 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;console.log('font-size',fontsize);$(window).on('scroll',function(event){scrolltop=$(this).scrollTop()*.5;console.log('scrolltop',scrolltop);$header.height(header_height-scrolltop>90?header_height-scrolltop:90);tmpfs=(300-(scrolltop<100?scrolltop:100))/300*fontsize;$slogan.css('font-size',tmpfs+"px");});};init();})(jQuery);
@@ -25,5 +25,29 @@
}); });
}; };
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;
console.log('font-size', fontsize);
$(window).on('scroll', function(event) {
scrolltop = $(this).scrollTop() * .5;
console.log('scrolltop', scrolltop);
$header.height(header_height-scrolltop > 90 ? header_height-scrolltop : 90);
tmpfs = (300 - (scrolltop < 100 ? scrolltop : 100)) / 300 * fontsize;
$slogan.css('font-size', tmpfs+"px");
});
};
init();
})(jQuery); })(jQuery);
@@ -11,12 +11,13 @@ $vars['print_title'] = !$vars['page'];
$alias = str_replace('/', '-', drupal_get_path_alias('node/'.$vars['node']->nid)); $alias = str_replace('/', '-', drupal_get_path_alias('node/'.$vars['node']->nid));
$vars['anchor_target'] = null;
if($node->type == "thematique"){ if($node->type == "thematique"){
$vars['id'] = $alias; // $vars['id'] = $alias;
// dsm($node, 'node'); // dsm($node, 'node');
// $current_state = workflow_state_load_single($node->workflow); // $current_state = workflow_state_load_single($node->workflow);
// dsm($current_state, "state"); // dsm($current_state, "state");
$vars['anchor_target'] = $alias;
}else{ }else{
$vars["classes_array"][] = $alias; $vars["classes_array"][] = $alias;
$vars['id'] = "node-".$node->nid; $vars['id'] = "node-".$node->nid;
@@ -79,14 +79,10 @@
<a href="#main-content" class="element-invisible element-focusable"><?php print t('Skip to main content'); ?></a> <a href="#main-content" class="element-invisible element-focusable"><?php print t('Skip to main content'); ?></a>
</div> </div>
<div id="container">
<?php print $page_top; ?> <?php print $page_top; ?>
<?php print $page; ?> <?php print $page; ?>
<?php print $page_bottom; ?> <?php print $page_bottom; ?>
</div>
<!-- /container -->
<!-- Javascript at the bottom for fast page loading --> <!-- Javascript at the bottom for fast page loading -->
<?php print $scripts; ?> <?php print $scripts; ?>
@@ -85,7 +85,12 @@
<?php print $user_picture; ?> <?php print $user_picture; ?>
<?php if ($print_title): ?> <?php if ($print_title): ?>
<h2<?php print $title_attributes; ?>><?php print $title; ?></h2> <h2<?php print $title_attributes; ?>>
<?php if ($anchor_target): ?>
<span id="<?php print $anchor_target; ?>"></span>
<?php endif; ?>
<?php print $title; ?>
</h2>
<?php endif; ?> <?php endif; ?>
<div class="content"<?php print $content_attributes; ?>> <div class="content"<?php print $content_attributes; ?>>