Brian
Brian

Reputation: 294

Javascript click and hover function needed

Okay, So I don't want a website like this http://colorpx.com/, but the idea of how the Click and Hover function works. I can't seem to find that script they have or what it's called to look it up. But I'm sure it's very simple.

I want to be able to click and (not release) and drag over other Div's and change the element of multiply ones without having to release the mouse button.

Sorry for nooby question if this is something very simple.

Upvotes: 0

Views: 121

Answers (1)

Programming Guy
Programming Guy

Reputation: 7461

Pseudo code :

parentElement.onmousedown = function() {
   this.onmouseover = handleMouseOver;
}

document.onmouseup = function() {
   parentElement.onmouseover = null;
}

function handleMouseOver(oEvent) {
   var el = oEvent.srcElement || oEvent.target;
   // do something with he mouse overed element.
}

Upvotes: 1

Related Questions