Vreau sa implementez un meniu javascript (stikymenu):
Am urmatorul cod:
Cod: Selectaţi tot
<script>
$(function() {
// grab the initial top offset of the navigation
var sticky_navigation_offset_top = $('#sticky_navigation').offset().top;
// our function that decides weather the navigation bar should have "fixed" css position or not.
var sticky_navigation = function(){
var scroll_top = $(window).scrollTop(); // our current vertical position from the top
// if we've scrolled more than the navigation, change its position to fixed to stick to top, otherwise change it back to relative
if (scroll_top > sticky_navigation_offset_top) {
$('#sticky_navigation').css({ 'position': 'fixed', 'top':0, 'left':0 });
} else {
$('#sticky_navigation').css({ 'position': 'relative' });
}
};
// run our function on load
sticky_navigation();
// and run it again every time you scroll
$(window).scroll(function() {
sticky_navigation();
});
// NOT required:
// for this demo disable all links that point to "#"
$('a[href="#"]').click(function(event){
event.preventDefault();
});
});
</script>Iar rezultatul se poate veadea la adresa www. mvc.anuntul10.ro
Iar in css am urmatorul id: #sticky_navigation { width:100%; height:50px; background: url(../images/trans-black-60.png); -moz-box-shadow: 0 0 5px #999; -webkit-box-shadow: 0 0 5px #999; box-shadow: 0 0 5px #999; }
As vrea ca atunci cand se da scroll si meniul devine fixed sa aiba alta forma, as putea sa creez un alt id cu alta formatare insa nu stiu cum sa modific javascriptul.
Multumesc anticipat!