Skip to content

Dynamic loaded elements are not draggable  #324

@ebody

Description

@ebody

Elements loaded after events are not draggable.

<!DOCTYPE html>
<html>
    <head>
        <meta charset='UTF-8'>
        <title>Title</title>
        <meta name="description" content="">
        <meta http-equiv='X-UA-Compatible' content='IE=edge'>
        <meta name='viewport' content='width=device-width, initial-scale=1'>
    </head>
<body>

    <main>
        <div>Drag me!</div>
    </main>
    
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>        
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
    <script src='touchpunch.js'></script>
    <script src='js.js'></script>
</body>
</html>
$( document ).ready(function() {

    /**
     *  orientationchange
     */             

        $(window).on('orientationchange', function(e){
            // is not draggable
            $('main').append('<div>Orientationchange Result</div>');
        });

        $('main > div:eq(0)').click(function(){
            // is not draggable
            $('main').append('<div>Click Result</div>');
        });

    /**
     *  draggable
     */
        
        $('div').draggable({
            cursor: 'pointer'
        });

});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions