I'm now facing another thing that I can't figure out how to do.
I'm new to jQuery and I'm trying to make an icon draggable and when you drop it in the folder(.folder div) It will be moved there.
div on the center of the page (I want them draggable) are icons, when you drag them and then drop them on a folder on the left, it will be moved there.
Here you can see what it looks like (Better using Firefox) : http://narks.xtreemhost.com/
This is only a test page to show you. Anyone can help me with that please?
To know the structure of the webpage, see Windows 7 explorer in CSS layout (Thanks again to Ivan Ivanić for his precious help1)
EDIT jQuery Drag & Drop :
$( "div.explorer_icon" ).draggable({
opacity: 0.50,
revert: true,
distance: 30,
zIndex: 9999,
scroll: false,
appendTo: 'body',
containment: 'window',
helper: 'clone'
});
$( "#navbar div.item_list" ).droppable({
accept: '.explorer_icon',
hoverClass: 'item_list_hover',
tolerance: 'pointer',
drop: function(event, ui) {
}
});
I'd highly recommend jqueryui. Demos here: http://jqueryui.com/demos/. Note the link to their Selectable and Draggable objects.
Additionally, from a quick scan of your problems, it looks like a more specific solution would be the Sortable, which I love. Here's the two-list sortable with list interminglings: http://jqueryui.com/demos/sortable/#connect-lists
Update: You also state that you need to leave the containing div and such. Here is the specific page on boundaries for draggable: http://jqueryui.com/demos/draggable/#constrain-movement. And in general, note the links to different examples on the right sidebar for each of the jQueryUI features. They represent everything that is available out of the box. If you need to go above and beyond, please send your implementation to the jqueryUI folks. Who knows, it might become the next feature of the next version of jqueryUI.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With