Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • lindgreen Friend
    #186598

    Hi

    I have added this code for the script mega.js: $(function ()
    {
    // Get the initial position of the menu.
    var menuTop = $(‘ja-mainnav’).offset().top;

    $(window).scroll(function ()
    {
    // Check position
    if ($(window).scrollTop() > menuTop)
    {
    $(‘ja-mainnav’).addClass(‘.fixed’);
    }
    else
    {
    $(‘ja-mainnav’).removeClass(‘.fixed’);
    }
    });
    });

    and i have added this code to template.css:

    .fixed{
    position: fixed;
    top: 0;
    }

    But somehow i can’t make it work, do you have any idea of what the problem could be?

    Wall Crasher Developer
    #489485

    Hi lindgreen,

    I would recommend you use Mootools code for Joomla.

    Here your scripts:


    window.addEvent('load', function(){
    var janav = $('ja-mainnav'),
    menutop = janav.getCoordinates().top;

    window.addEvent('scroll', function(){
    if (window.getScrollTop() > menutop) {
    janav.addClass('fixed');
    } else {
    janav.removeClass('fixed');
    }
    });
    });

    Hope it helps.

    Regards

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

This topic contains 2 replies, has 2 voices, and was last updated by  Wall Crasher 11 years, 7 months ago.

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