Jump to content

dynamic fixed header


j3velez

Recommended Posts

Hello, Im looking something like THIS header, when you scroll down the header appears dynamically (it's not fixed). I want to "transform" my header into another (or the same but with different design) when scroll down.

 

Do you know how to do it? or you know where can I find a module for this?

 

Regards

 

Jose Velez

Link to comment
Share on other sites

Hi,

You just have to add "position:fixed" to the header section of your store (to the block you want to stick)

 

p.s. in the css, of course

Thanks for your answer but if you see the page (THIS) the header is not fixed. I dont want to use "position:fixed". I want to "transform" my header into another (or the same but with different design) when scroll down.

Link to comment
Share on other sites

  • 3 months later...

I hope you want to do something like in this website mytechskool.com?

 

#hSlideContainer complete part form css and add the hsliderContainer div in the page template mostly in header section and this javascript

 

 

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js' type='text/javascript'></script>

<script type="text/javascript">

$(function() {

var bar = $('#hSlideContainer');

var top = bar.css('top');

$(window).scroll(function() {

if($(this).scrollTop() > 250) {

bar.stop().animate({'top' : '0px'}, 0);

} else {

bar.stop().animate({'top' : top}, 0);

}

});

});

</script>

 

to make the header appear after you scroll down and to disappear if you scroll up.

Link to comment
Share on other sites

When i edit the topmenu template and add the appropriate the problem is re-compiling the tpl file. When i select Force compile, i just receive an error 500 - means it couldn't pull the page after rebuilding. I also deleted the cache & compile folder in smarty so nothing is coming up from old cache.

 

Should i need to try the same from a fast internet connection ? i hope that won't make any sense.

 

Please let me know.

Link to comment
Share on other sites

When i edit the topmenu template and add the appropriate the problem is re-compiling the tpl file. When i select Force compile, i just receive an error 500 - means it couldn't pull the page after rebuilding. I also deleted the cache & compile folder in smarty so nothing is coming up from old cache.

 

Should i need to try the same from a fast internet connection ? i hope that won't make any sense.

 

Please let me know.

 

you should check php error log why this error appeared, i think that the problem is with script. You paste script to the tpl file, am I right? If so, you should use {literal}{/literal} tags

 

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js' type='text/javascript'></script>
<script type="text/javascript">

{literal}

$(function() {
var bar = $('#hSlideContainer');
var top = bar.css('top');
$(window).scroll(function() {
if($(this).scrollTop() > 250) {
bar.stop().animate({'top' : '0px'}, 0);
} else {
bar.stop().animate({'top' : top}, 0);
}
});
});

{/literal}

</script>

  • Like 1
Link to comment
Share on other sites

you should check php error log why this error appeared, i think that the problem is with script. You paste script to the tpl file, am I right? If so, you should use {literal}{/literal} tags
 

 

Man! :) You are rocking. That's exactly the issue. So for all scripts i guess i've to add the literal smarty tag.

 

Awesome, Thanks man. :)

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...