. The realization method of floating window dragging in net

Source: Internet
Author: User

The. NET Floating window drag implementation method. Also mentioned is a jquery plug-in Easydrag, this plug-in processing drag release is useful, but since I last modified, now I found another bug. In a page where Easydrag is applied, a script error that "object cannot be found" appears when the page loads. After careful examination, the problem was found to be the early binding of the document in Easydrag MouseMove and MouseUp events, and sometimes the script loaded when the document is not ready, nature will "not find the object".

The solution to the problem is simple, and we postpone the binding of these two events:

以下为引用的内容:
  function mousemove_handler(e){
  //
  }
  function mouseup_handler(e){
  //
  // 解除鼠标移动和弹起事件的处理函数绑定
  $(document).unbind("mousemove", mousemove_handler).unbind("mouseup", mouseup_handler);
  }
  $("#拖动目标").mousedown(function(){
  //
  // 添加鼠标移动和弹起事件的处理函数绑定
  $(document).mousemove(mousemove_handler).mouseup(mouseup_handler);
  })

Note that the Unbind event is also necessary in the code above.

Also recommend a good jquery plugin--background iframe.

We used to write calendar controls in the Web page to cover the effects of <select>.

The invocation method is also very simple:

以下为引用的内容:
<div>
 <iframe></iframe>
</div>

To load the pop-up content. But there is a problem, that is, the loaded document and the current document is not a page, then in the ASP.net and other background code, it is not very convenient to do data binding, because more than one page, you need more than a lot of unnecessary variable transfer work.

The principle of background iframe is that you can write the pop-up content directly in the <div></div> of the current page, it is responsible for dynamically inserting a transparent IFRAME as the background mask in this div, which can also achieve occlusion <select> effect.

The invocation method is also very simple:

以下为引用的内容:
$("#some_layer").bgiframe();

That's it.

It is thought that programming is really the most important idea. Remember the past to see Meizz Calendar control code, through the way of the IFrame to write, realize very complex, now if the background iframe this idea, the problem is very simple to solve.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.