There is no easy "how to do it" method.
What I would suggest is to use already created code for top bar and jus add a little bit to it... Check this file:
- Code: Select all
/templates/gk_creativity/js/gk.scripts.js
and find this section:
- Code: Select all
jQuery(window).scroll(function() {
var intro = jQuery('body').find('.gkIsWrapperFixed');
var introh = intro.height();
var pos = jQuery(window).scrollTop();
if(pos >= 100) {
jQuery('#gkTop').css('top', '0px');
} else if(pos < 100) {
jQuery('#gkTop').css('top', '-100px');
}
if(!navigator.userAgent.match(/msie 8/i) && pos < introh && jQuery(window).width() > 1040) {
jQuery(intro).find('.figcaption').css('top', Math.floor((1.0 * pos) / 8.0) + "px");
}
if(IS.length > 0) {
if(pos > introh) {
if(IS.css('display') != 'none') {
IS.css('display', 'none');
}
} else {
if(IS.css('display') != 'block') {
IS.css('display', 'block');
}
}
}
});
what it does - when you csroll over 100px in your browser it sets inline css of #gkTop element to 0 px (or -100px if the scroll value is less)
those lines does the trick:
- Code: Select all
if(pos >= 100) {
jQuery('#gkTop').css('top', '0px');
} else if(pos < 100) {
jQuery('#gkTop').css('top', '-100px');
}
To stick and unstick another element you can modify its css the same way, adding another line in if statement. Just use different ID for your footer element.