Basic DraggingAny CBE object can receive a drag event. Just add an event listener. The listener will receive 1 argument:
The following are the most important CrossBrowserEvent properties for use in a drag listener.
If all you want the listener to do is this: CBE objects also support dragStart and dragEnd events. See this example. The following shows how easy it is to make a CBE object draggable.
<html>
<head>
<style type='text/css'><!--
.clsCBE {
position:absolute; visibility:hidden; overflow:hidden;
width:150px; height:150px; clip:rect(0,150px,150px,0);
color:#ffffff; background:#0000ff; layer-background-color:#0000ff;
}
--></style>
<script type='text/javascript' src='../cbe_core.js'></script>
<script type='text/javascript' src='../cbe_event.js'></script>
<script type='text/javascript'><!--
function windowOnload() {
with (document.getElementById('E1').cbe) {
moveTo('center');
show();
addEventListener('drag');
}
}
//--></script>
</head>
<body>
<div id='E1' class='clsCBE'>E1</div>
</body>
</html>
|