No offense, but it's like you're trying to break the fourth wall here.
I might be mistaken, but only the OS aware of the existence of the dual monitors. So, when you expand the browser across those monitors, the browser has no awareness of the monitors it occupied, only that its window.screen.width
is larger than normal.
So, technically, since our HTML elements run inside a browser, we shouldn't be able to exactly detected which area of the screen are on each of the monitors.
On the other hand, how about we make use of two different browser window instead? E.g. use javascript to open a new window with
var secondWindow = window.open("<url of another page>");
Then on the second window, which you could drag it on another screen, display another <div>
so that each window occupied each of the screen, thus having 2 <div>
on each screen.
Then, in order to coordinate the interaction/animation between the two windows. Do it either through the secondWindow
or window.opener
object.
// on the first window, you can call javascript function on second window
secondWindow.doSomething();
// on the second window, you can call javascript function on the first window
window.opener.doSomething();
Note: The above example will only work if both of pages host under the same domain. Else, you'll need to rely on postMessage
API to coordinate between the two windows.