This topic has 11 replies, 3 voices, and was last updated 8 years by Abe.

  • Author
  • #71786
     sarpdiego
    Participant

    Hello Seventhqueen Team,

    i actualy want to make my website a litle bit confortabler for my mobile users, can you say me 2 commands to open and close the side menu?

    i dont mean a toogle functionality, i mean one function which open the side menu and one to close it.

    #71922
     sarpdiego
    Participant

    *bump*

    #71924
     sarpdiego
    Participant

    i only found this in the theme JS

    COPY CODE
    sideMenu: function() {
                f(".open-sidebar").on("click", function() {
                    f("body").toggleClass("offcanvas-open");
                    f(".offcanvas-sidebar").toggleClass("is-open");
                    return false
                });
                f(".kleo-page").on("click", function(o) {
                    if (f(o.target).hasClass("open-sidebar") || f(o.target).closest(".open-sidebar").length > 0) {
                        return
                    }
                    f("body").removeClass("offcanvas-open");
                    f(".offcanvas-sidebar").removeClass("is-open")
                })
            },
    #71929
     sharmstr
    Moderator

    Those are the functions. Not sure exactly what you are after. Perhaps if you try explaining what you want to accomplish again, I’ll be able to help.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #71982
     sarpdiego
    Participant

    ok, i make me a javascript that alerts me if i swipe right or left with the finger over my touchscreen(on phones and tablets) so i want a open and close comand for the swipe menu. sorry for my bad english, i hope you understand what i mean and what i want. 🙂

    #72000
     sharmstr
    Moderator

    looks like you’ve already found the answer, which is, it cant be done: https://archived.seventhqueen.com/forums/topic/side-menu-gestures-swipe-to-openclose

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #72014
     sarpdiego
    Participant

    no, i know that the theme officaly dont support a swpie menu, so i want to make a own. what i meen is what must i type in javascript to open the menu and what must i type in to close it, i dont talk about a toggle function.

    #72021
     sharmstr
    Moderator

    I still dont know what you are asking then. Are you saying to want it opened on page load? Is the user going to click something? Basically, you can target the .open-sidebar class with whatever code you’re trying to use.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #72058
     sarpdiego
    Participant

    Sorry for my bad english,

    i Have this script to make swipe interactions for Smartphone and Tablet users

    COPY CODE
    <script>
    document.addEventListener('touchstart', handleTouchStart, false);        
    document.addEventListener('touchmove', handleTouchMove, false);
    
    var xDown = null;                                                        
    var yDown = null;                                                        
    
    function handleTouchStart(evt) {                                         
        xDown = evt.touches[0].clientX;                                      
        yDown = evt.touches[0].clientY;                                      
    };                                                
    
    function handleTouchMove(evt) {
        if ( ! xDown || ! yDown ) {
            return;
        }
    
        var xUp = evt.touches[0].clientX;                                    
        var yUp = evt.touches[0].clientY;
    
        var xDiff = xDown - xUp;
        var yDiff = yDown - yUp;
    
        if ( Math.abs( xDiff ) > Math.abs( yDiff ) ) {/*most significant*/
            if ( xDiff > 0 ) {
                /* left swipe */ 
                /* Here the Side Menu close */
            } else {
                /* right swipe */
                /*Here the side Menu open */
            }                       
        } else {
            if ( yDiff > 0 ) {
                /* up swipe */ 
            } else { 
                /* down swipe */
            }                                                                 
        }
        /* reset values */
        xDown = null;
        yDown = null;                                             
    };
    </script>

    i comment out the section where i want to open and to close the side menu.
    i hide the top menu for mobile users because i dosn’t like it, i want a smarter look of the menu, like facebook.
    so what i need is a function like opensidemenu(); and closesidemenu();

    im not a js pro maybe you can ask the programmer of the side menu(or are you the programmer?) what code i exactly need to open the side menu and close the side menu.

    #72399
     Abe
    Keymaster

    Hi there, sorry for the late reply.
    This should be for opening the sidemenu:

    COPY CODE
    
    
                $('body').toggleClass('offcanvas-open', true);
                $('.offcanvas-sidebar').toggleClass('is-open', true);
                return false;
    
    

    and this for closing it

    COPY CODE
    
    
                $('body').toggleClass('offcanvas-open', false);
                $('.offcanvas-sidebar').toggleClass('is-open', false);
                return false;
    
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #72416
     sarpdiego
    Participant

    Thankyou Abe, thats what i need it works perfect 🙂

    #72534
     Abe
    Keymaster

    awesome 😉

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

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

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?