Jump to content
Дизайн и модификация IPS Community IPBSkinsBETA
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Qartvela™

Стандартный всплывающий окно

Recommended Posts

<li class="left"><a href='#' id='rimShowPopup'>Live</a></li>
<div id='rimPopup' style='display:none;'>
       <h3 style="cursor:move">Live ...</h3>
<iframe frameborder="0" width="800" height="450" src="..."></iframe>
</div>
<script type='text/javascript'>
//<![CDATA[
showPopup = function(e) {
       Event.stop(e);
       popup = new ipb.Popup( 'rimPopup', { type: 'pane', modal: false, w: '800px', h: '450px', initial: $('rimPopup').innerHTML, hideAtStart: false, close: 'a[rel="close"]' } );
       return false;
}
if( $('rimShowPopup') ) {
       $('rimShowPopup').observe('click', showPopup);
}
//]]>
</script>

 

Нужно добавить функцию "draggable" без jQuery. как можно реализовать?

Share this post


Link to post
Share on other sites

<li class="left"><a href='#' id='rimShowPopup'>Live</a></li>

<div id='rimPopup' style='display:none;'>
       <h3 style="cursor:move">Live ...</h3>
<iframe frameborder="0" width="800" height="450" src="..."></iframe>
</div>

<script type='text/javascript'>
//<![CDATA[
showPopup = function(e) {
       Event.stop(e);
       popup = new ipb.Popup( 'rimPopup', { type: 'pane', modal: false, w: '800px', h: '450px', initial: $('rimPopup').innerHTML, hideAtStart: false, classname: 'draggable', close: 'a[rel="close"]' } );
       return false;
}
if( $('rimShowPopup') ) {
       $('rimShowPopup').observe('click', showPopup);
}
//]]>
</script>

<script type='text/javascript'>
(function (document) {
   'use strict';
   function startDrag(evt) {
       var diffX = evt.clientX - this.offsetLeft,
           diffY = evt.clientY - this.offsetTop,
           that = this; 
       function moveAlong(evt) {
           that.style.left = (evt.clientX - diffX) + 'px';
           that.style.top = (evt.clientY - diffY) + 'px';
       }
       function stopDrag() {
document.removeEventListener('mousemove', moveAlong);
document.removeEventListener('mouseup', stopDrag);
       }
document.addEventListener('mouseup', stopDrag);
document.addEventListener('mousemove', moveAlong);
   }
   function startDragIfDraggable(evt) {
       if (evt.target.classList.contains('draggable')) {
    startDrag.call(evt.target, evt);
       }
   }
document.body.addEventListener('mousedown', startDragIfDraggable);
}
(document));
</script>

 

но остался один проблема, когда перемещаешь эту "DIV id='rimPopup'" над текстом, начинается выделение текста.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...