Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • costabreeze Friend
    #193391

    Hello Happy new year All

    i need code to make Main Menu (navbar) fixed for the top but only after the page is scrow down. the same like Ja Magz template navbar, and where to put the code?

    thanks !

    TomC Moderator
    #517069

    So that we can try to best assist you, please provide the url of the site you’re working on,
    as well as set “Optimize CSS” to “No” within your Template Manager–Options–General settings

    costabreeze Friend
    #517070

    http://www.gamebreeze.net
    Optimize CSS – NO
    thanks

    i try with something like navbar-fixed-top but the navbar going over the header were is the logo..

    TomC Moderator
    #517072

    Try This . . . .

    Within file path –> templates/ja_obelisk/css/template.css
    at line 1946, add the following properties – as follows:


    .t3-mainnav {
    background: none repeat scroll 0 0 #151515
    border-bottom: 0 none;
    border-top: 0 none;
    position: fixed;
    width: 100%;
    top: 40px;

    }

    then, at line 5366, modify as follows:


    .t3-header {
    background-color: #F8F8F8
    background-image: linear-gradient(to bottom, #FFFFFF, #EEEEEE)
    background-repeat: repeat-x;
    padding-bottom: 20px;
    padding-top: 20px;
    position: fixed;
    width: 100%;

    }

    There’s a bit more to do with it, but see if that is going in the right direction.

    costabreeze Friend
    #517076

    Yes thats going in right direction but forgot for t3-header i dont want t3-header fixed, need to be hide when somebody scrow down a bit the webpage(i dont gonna use the code for t3-header).
    1 Now t3-mainnav has to be fixed for top (0px) but only when the page scrow down a bit

    and need to be fixed some bugs i see now when i scrow down the page the modules with adsense code are over the t3-mainnav! dont need to be like that t3-mainnav shoud stay over every module on site page right ? (edit only adsense code not the module)

    i use only
    at line 1946, add the following properties – as follows:
    Code:
    .t3-mainnav {
    background: none repeat scroll 0 0 #151515
    border-bottom: 0 none;
    border-top: 0 none;
    position: fixed;
    width: 100%;
    }

    at line – 5590
    .t3-mainbody {
    padding-bottom: 40px;
    padding-top: 65px;
    }

    I use different t3-mainbody padding because on my site t3-header padding is different from default code on ja obelisk !

    check on my site how is it now

    costabreeze Friend
    #517079

    i add to t3-mainnav

    z-index: 99999;

    now ALWAYS appears above anything on a page!

    only left to be fixed right for the top after scrolling down the page… but i dont know this how to do it ( ithink its java code rirht?)

    i found this for reference if helps ( maybe we can use ja magz javascript ??? )
    http://stackoverflow.com/questions/1216114/how-can-i-make-a-div-stick-to-the-top-of-the-screen-once-its-been-scrolled-to

    phong nam Friend
    #517107

    You can try to put override css styles below into the end of template.css file:

    .t3-header {
    margin-top: 45px;
    }

    .t3-mainnav {
    top: 0;
    }

    costabreeze Friend
    #517158

    <em>@Leo Burnetts 404157 wrote:</em><blockquote>You can try to put override css styles below into the end of template.css file:

    .t3-header {
    margin-top: 45px;
    }

    .t3-mainnav {
    top: 0;
    }

    </blockquote>

    not this ! how i say i need the efect of ja magz template mainnav :confused:
    leave t3-header its nothing about it

    Check this example.

    costabreeze Friend
    #517164

    Can you help me with this simple ?

    $(document).ready(function() {
    // Cache selectors for faster performance.
    var $window = $(window),
    $mainMenuBar = $('#mainMenuBar'),
    $mainMenuBarAnchor = $('#mainMenuBarAnchor');

    // Run this on scroll events.
    $window.scroll(function() {
    var window_top = $window.scrollTop();
    var div_top = $mainMenuBarAnchor.offset().top;
    if (window_top > div_top) {
    // Make the div sticky.
    $mainMenuBar.addClass('stick');
    $mainMenuBarAnchor.height($mainMenuBar.height());
    }
    else {
    // Unstick the div.
    $mainMenuBar.removeClass('stick');
    $mainMenuBarAnchor.height(0);
    }
    });
    });

    costabreeze Friend
    #517170

    job done 🙂

    i add this css code in template.css file (clone from ja magz template)

    .t3-mainnav.min-mainnav {
    width: 100%;
    top: 0;
    }
    .affix {
    z-index: 1030;
    }

    then i copy from ja magz/js/script file to ja obelisk/js/script file this

    // add class for mainmenu when scroller
    (function(){
    var min = null,
    sid = null,
    mainnav = $('#t3-mainnav'),
    navbar = mainnav.find('.navbar:first'),
    breakpoint = navbar.length ? navbar.offset().top : 0;

    if(mainnav.length){
    $(window).scroll(function() {

    if(min != $(window).scrollTop() > breakpoint){
    min = !min;

    min ? mainnav.addClass('affix') : mainnav.removeClass('min-mainnav');

    //force reflow
    mainnav[0].offsetWidth;
    mainnav.prevAll('.hplace').remove();

    if(min){
    $('<div class="hplace clearfix"></div>').insertBefore(mainnav).css('height', mainnav.outerHeight(true));
    mainnav.addClass('min-mainnav');
    } else {
    mainnav.removeClass('affix');
    }
    }
    })
    }

    })();

    and now looks perfect http://www.gamebreeze.net

    Thank you TomC for helping me with this 🙂 ( can you edit topic name to navbar fixed for the top after scroll )

    TomC Moderator
    #517415

    Glad I could be of assistance . . . All the best with your continuing site development.

    🙂

Viewing 11 posts - 1 through 11 (of 11 total)

This topic contains 11 replies, has 3 voices, and was last updated by  TomC 10 years, 10 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum