Very noobish question, but yet couldn't find answer here.
I want to perform click-and-hold (I suppose it's mousedown, or draggable, but don't work properly for me) on the element on the onmouseover event.
Thank you in advance!
Very noobish question, but yet couldn't find answer here.
I want to perform click-and-hold (I suppose it's mousedown, or draggable, but don't work properly for me) on the element on the onmouseover event.
Thank you in advance!
Hello and welcome to Stack Overflow.
If you are using jQuery and comfortable with such, jQueryUI provides a library that should allow you to perform a click and drag manoeuvre as requested.
An example of this in action could be as follows :
// Include your necessary files in your HEAD document.
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#draggable" ).draggable();
$( "#droppable" ).droppable({
drop: function( event, ui ) {
$( this )
.addClass( "ui-state-highlight" )
.find( "p" )
.html( "Dropped!" );
}
});
} );
</script>
Include the following in your HTML :
<div id="draggable" class="ui-widget-content">
<p>Drag me to my target</p>
</div>
<div id="droppable" class="ui-widget-header">
<p>Drop here</p>
</div>