Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Menu with opening window element with position fixing ( JS )

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #250097
    csizi23
    Participant

    Hi

    Might some one can help me.
    Is there a way to fix the opening windows position, so it open’s at the same position like the first one in line next to the first menu element ? Now it all appearing next to their own menu buttons.
    Is it available to make it responsive as well ?

    http://codepen.io/csizi23/pen/Grjeab

    <script>
    function hideText() {
    $(“.sidemenu”).slideUp();
    $(“.box”).removeClass(“active”);
    }

    function unbindClickOutsideTrigger() {
    $(document).off(“mouseup.text”);
    }
    function bindClickOutsideTrigger() {
    $(document).on(‘mouseup.text’,function (e){
    var container = $(“.sidemenu”);
    if (!container.is(e.target) // if the target of the click isn’t the container…
    && container.has(e.target).length === 0) // … nor a descendant of the container
    {
    hideText();
    unbindClickOutsideTrigger();
    }
    else {

    }
    

    });
    }

    $(“.box”).click(function() {
    if ( $(“.box”).hasClass(“active”) ){
    hideText();
    unbindClickOutsideTrigger();
    }
    else {
    bindClickOutsideTrigger();
    // this section is make the button toggle, and gave a focus, in css when button on focus change color.
    $parent_box = $(this).closest(‘.box’);
    $parent_box.siblings().find(‘.sidemenu’).slideUp();
    $parent_box.find(‘.sidemenu’).slideToggle(800);
    }
    });
    </script>

    <body>





    Menu First Line

    menu1 text





    Menu Second Line

    menu2 text





    Menu Third Line

    menu3 text





    Menu Fourth Line

    menu4 text

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.