Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • in reply to: Javascript command to open and close the Side Menu #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.

    in reply to: Javascript command to open and close the Side Menu #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")
                })
            },
Viewing 2 posts - 1 through 2 (of 2 total)

Log in with your credentials

Forgot your details?