Please recommend a JQuery plugin that handles collision detection for draggable elements [closed]

You can try jquery-collision plus jquery-ui-draggable-collision. Full disclosure: I just wrote and released these on sourceforge. The first allows this: var hit_list = $(“#collider”).collision(“.obstacle”); which is the list of all “.obstacle” that overlap “#collider”. The second allows: $(“#collider”).draggable( { obstacle: “.obstacle” } ); Which gives you (among other things), a “collision” event to bind to: … Read more

Qt 4: Move window without title bar

Try this to move the window manually: void PopupWindow::mousePressEvent(QMouseEvent *event){ mpos = event->pos(); } void PopupWindow::mouseMoveEvent(QMouseEvent *event){ if (event->buttons() & Qt::LeftButton) { QPoint diff = event->pos() – mpos; QPoint newpos = this->pos() + diff; this->move(newpos); } } And declare QPoint mpos somewhere.

Retrieve latitude and longitude of a draggable pin via Google Maps API V3

Either of these work google.maps.event.addListener(marker, ‘click’, function (event) { document.getElementById(“latbox”).value = event.latLng.lat(); document.getElementById(“lngbox”).value = event.latLng.lng(); }); google.maps.event.addListener(marker, ‘click’, function (event) { document.getElementById(“latbox”).value = this.getPosition().lat(); document.getElementById(“lngbox”).value = this.getPosition().lng(); }); You might also consider using the dragend event also google.maps.event.addListener(marker, ‘dragend’, function (event) { document.getElementById(“latbox”).value = this.getPosition().lat(); document.getElementById(“lngbox”).value = this.getPosition().lng(); });

Restrict jQuery draggable items from overlapping/colliding with sibling elements

Edit: New Solution I found a plugin for this called JQuery UI Draggable Collision. Using this, implementing your desired functionality becomes trivial. See the following jsFiddle example: http://jsfiddle.net/q3x8w03y/1/ (This uses version 1.0.2 of JQuery UI Draggable Collision, along with JQuery 1.7.2 and JQueryUI 1.1.18.) Here is the code: $(“#dragMe”).draggable({ obstacle: “#butNotHere”, preventCollision: true, containment: “#moveInHere” … Read more

How can i make a MatDialog draggable / Angular Material

Update since Angular Material 7 You can simply use cdkDrag directive from @angular/cdk/drag-drop dialog.html <h1 mat-dialog-title cdkDrag cdkDragRootElement=”.cdk-overlay-pane” cdkDragHandle> Hi {{data.name}} </h1> Stackblitz Example Previous answer: Since there is no official solution for that, I’m going to write custom directive that will be applied on a dialog title and do all job for us: dialog.html … Read more

jQuery draggable shows helper in wrong place after page scrolled

This might be a related bug report, it’s been around for quite a while: http://bugs.jqueryui.com/ticket/3740 It seems to happen on every browser I tested (Chrome, FF4, IE9). There are a few ways you can work around this issue: 1. Use position:absolute; in your css. Absolutely positioned elements don’t seem to be affected. 2. Make sure … Read more

Moveable/draggable

Is jQuery an option for you? It makes what you are doing really simple since the code already exists. http://jqueryui.com/demos/draggable/ Demo JavaScript Code window.onload = addListeners; function addListeners(){ document.getElementById(‘dxy’).addEventListener(‘mousedown’, mouseDown, false); window.addEventListener(‘mouseup’, mouseUp, false); } function mouseUp() { window.removeEventListener(‘mousemove’, divMove, true); } function mouseDown(e){ window.addEventListener(‘mousemove’, divMove, true); } function divMove(e){ var div = document.getElementById(‘dxy’); div.style.position … Read more

jQuery Drag And Drop Using Live Events

Wojtek’s solution worked perfectly for me. I wound up changing it a tad bit to make it extend jQuery… (function ($) { $.fn.liveDraggable = function (opts) { this.live(“mouseover”, function() { if (!$(this).data(“init”)) { $(this).data(“init”, true).draggable(opts); } }); return this; }; }(jQuery)); Now instead of calling it like: $(selector).draggable({opts}); …just use: $(selector).liveDraggable({opts})