@ -41,7 +41,7 @@
< / div >
< / div >
< div id = "implicancies_05" >
< div id = "implicancies_05" >
< div id = "shell_03" class = "" > < div class = "" id = "shell_03header" > click here do move< / div > < iframe name = "shell" id = "iframe_clock" src = 'blank12_5.html' > < / iframe > < / div >
< div id = "shell_03" class = "" onmousedown = 'mydragg.startMoving(this,"container",event);' onmouseup = 'mydragg.stopMoving("container");' > < div class = "" id = "shell_03header" > click here do move< / div > < iframe name = "shell" id = "iframe_clock" src = 'blank12_5.html' > < / iframe > < / div >
< div id = "info" >
< div id = "info" >
< div id = "title" > < / div >
< div id = "title" > < / div >
< div id = "authors" > < / div >
< div id = "authors" > < / div >
@ -305,71 +305,49 @@
var dragItem = document.querySelector("#shell_03");
var mydragg = function(){
var container = document.querySelector("#implicancies_05");
return {
move : function(divid,xpos,ypos){
var active = false;
divid.style.left = xpos + 'px';
var currentX;
divid.style.top = ypos + 'px';
var currentY;
},
var initialX;
startMoving : function(divid,container,evt){
var initialY;
evt = evt || window.event;
var xOffset = 0;
var posX = evt.clientX,
var yOffset = 0;
posY = evt.clientY,
divTop = divid.style.top,
container.addEventListener("touchstart", dragStart, false);
divLeft = divid.style.left,
container.addEventListener("touchend", dragEnd, false);
eWi = parseInt(divid.style.width),
container.addEventListener("touchmove", drag, false);
eHe = parseInt(divid.style.height),
cWi = parseInt(document.getElementById(container).style.width),
container.addEventListener("mousedown", dragStart, false);
cHe = parseInt(document.getElementById(container).style.height);
container.addEventListener("mouseup", dragEnd, false);
document.getElementById(container).style.cursor='move';
container.addEventListener("mousemove", drag, false);
divTop = divTop.replace('px','');
divLeft = divLeft.replace('px','');
function dragStart(e) {
var diffX = posX - divLeft,
if (e.type === "touchstart") {
diffY = posY - divTop;
initialX = e.touches[0].clientX - xOffset;
document.onmousemove = function(evt){
initialY = e.touches[0].clientY - yOffset;
evt = evt || window.event;
} else {
var posX = evt.clientX,
initialX = e.clientX - xOffset;
posY = evt.clientY,
initialY = e.clientY - yOffset;
aX = posX - diffX,
}
aY = posY - diffY;
if (aX < 0 ) aX = 0;
if (e.target === dragItem) {
if (aY < 0 ) aY = 0;
active = true;
if (aX + eWi > cWi) aX = cWi - eWi;
}
if (aY + eHe > cHe) aY = cHe -eHe;
}
mydragg.move(divid,aX,aY);
}
function dragEnd(e) {
},
initialX = currentX;
stopMoving : function(container){
initialY = currentY;
var a = document.createElement('script');
document.getElementById(container).style.cursor='default';
active = false;
document.onmousemove = function(){}
}
},
}
function drag(e) {
}();
if (active) {
e.preventDefault();
if (e.type === "touchmove") {
currentX = e.touches[0].clientX - initialX;
currentY = e.touches[0].clientY - initialY;
} else {
currentX = e.clientX - initialX;
currentY = e.clientY - initialY;
}
xOffset = currentX;
yOffset = currentY;
setTranslate(currentX, currentY, dragItem);
}
}
function setTranslate(xPos, yPos, el) {
el.style.transform = "translate3d(" + xPos + "px, " + yPos + "px, 0)";
}