Autor Zpráva
zbystr
Profil *
zdravim, nejak jsem se zasekl, je tam nekde nejaka blbost, ale nemuzu na to prijit, muzete se nekdo na to juknout a poradi ?? Diky


function Iframe(){
_this = this;
this.dragObject = null;
this.mouseOffset = null;
this.mouseMove = function(ev){
ev = ev || window.event;
var mousePos = _this.mouseCoords(ev);
if(_this.dragObject){
_this.dragObject.style.position = 'absolute';
_this.dragObject.style.top = mousePos.y - _this.mouseOffset.y;
_this.dragObject.style.left = mousePos.x - _this.mouseOffset.x;
return false;
}
}
this.mouseCoords = function(ev){
if(ev.pageX || ev.pageY){
return {x:ev.pageX, y:ev.pageY};
}
return {
x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
y:ev.clientY + document.body.scrollTop - document.body.clientTop
};
}
this.getPosition = function(e){
var left = 0;
var top = 0;
while (e.offsetParent){
left += e.offsetLeft;
top += e.offsetTop;
e = e.offsetParent;
}
left += e.offsetLeft;
top += e.offsetTop;
return {x:left, y:top};
}

this.getMouseOffset = function(target, ev){
ev = ev || window.event;
var docPos = _this.getPosition(target);
var mousePos = _this.mouseCoords(ev);
return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
}

this.mouseUp = function(){
_this.dragObject = null;
}
}

Iframe.prototype.construct = function(e){
_this = this;
var header = document.createElement('div');
var footer = document.createElement('div');
var ifrm = document.createElement('iframe');
ifrm.src = 'http://www.seznam.cz';
ifrm.style.border = 'none';

header.style.height = '20px';
header.style.width='100%';
header.style.backgroundColor = '#CCC';


footer.style.height = '20px';
footer.style.width='100%';
footer.style.backgroundColor = '#CCC';

var win = document.createElement('div');
win.style.position = 'absolute';
win.style.left = '200px';
win.style.top = '200px';
win.style.width = '300px';
win.style.height = '200px';



win.appendChild(header);
win.appendChild(ifrm);
win.appendChild(footer);
win.onmousedown = function(ev){
_this.dragObject = this.parentNode;
_this.mouseOffset = _this.getMouseOffset(this, ev);
return false;
}
document.getElementsByTagName('body')[0].appendChild(win);

document.onmousemove = this.mouseMove;
document.onmouseup = this.mouseUp;
}



zbystr
Profil *
vysledek je ten, ze se ta mrcha okno ani nepohne
peta
Profil
co hlasi JS konzola?
FF - nastroje - chybova konzola
O - nastroje - javascript - konzola
IE - dole vlevo bud ve stavove liste obrazek modre "e" nebo zluty vykricnik /!\
Toto téma je uzamčeno. Odpověď nelze zaslat.