简体   繁体   中英

Draggable object - dragging from title

I have this HTML popup object 在此处输入图片说明 I made it draggable with jQuery. Now I can drag this popup from any point in the object, which causes problems with the scrolling - if I try to scroll by dragging the little rectangle inside the scrollbar - it drags the whole popup.

I want to make it possible to drag the popup only by dragging the title - so if I drag the title it will drag the whole popup, but I won't be able to drag the popup from any other point (the textarea, the white background, the scrollbar....)

You can use handles in Jquery UI

If specified, restricts dragging from starting unless the mousedown occurs on the specified element(s). Only elements that descend from the draggable element are permitted.

Eg:

$( "your popup" ).draggable({
  handle: "title id"
});

Refer handle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM