-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I'm using requestFullscreen to make a div Fullscreen.
The problem is that in this div I append an image that should display a menupopup when it pressed.
When I'm not in fullscreen, the menupopup appears normally, but when I'm in fullscreen it "does not appear", or appears "bellow of the div" that is in fullscreen, because the application adds Menupopup by default in the root of the html, and the browser only show the content inner the div.
Any suggestions how I can solve? The Menupopup need to be added inside the div that goes to fullscreen and not the root (I tried SetParent and appendChild).
Best regards.
Please post your example to the ZK Bug Tracker.
Hi,
A quick workaround as below:
<zk xmlns:w="client"> <script type="text/javascript"><![CDATA[ function fixFullScreen() { var div = jq('$div')[0], mpp = jq('$mpp')[0]; if (div.isfullscreen) { var mstyle = mpp.style, dstyle = div.style; div.mpp = mpp; div.mppParent = mpp.parentNode; div.appendChild(mpp); setTimeout(function () { mstyle.left = parseInt(div.offsetLeft) + 50 + 'px'; mstyle.top = parseInt(div.offsetTop) + 50 + 'px'; }, 50); } } ]]></script> <div id="div"> <image src="/img/inet.png" width="100px" height="100px"> <attribute name="onClick"> mpp.open("50", "50"); Clients.evalJavaScript("fixFullScreen();"); </attribute> </image> </div> <button label="full screen"> <attribute w:name="doClick_"> function (evt) { var div = jq('$div')[0], func = div.requestFullScreen || div.webkitRequestFullScreen || div.mozRequestFullScreen, onFsChange = function (div) { var fs = !div.isfullscreen; div.isfullscreen = fs; // move popup back if not fullscreen if (!fs) { var p = div.mppParent, mpp = div.mpp, mstyle = mpp.style; p.appendChild(mpp); if (mpp.style.display != 'none') setTimeout(function () { mstyle.left = parseInt(div.offsetLeft) + 50 + 'px'; mstyle.top = parseInt(div.offsetTop) + 50 + 'px'; }, 0); } }; if (!div.fullScreenListener) { if (zk.ff) { document.addEventListener('mozfullscreenchange', function(e) { onFsChange(div); }, true); } else if (zk.chrome) { document.addEventListener('webkitfullscreenchange', function(e) { onFsChange(div); }, true); } else { div.addEventListener('fullscreeneventchange', function(e) { onFsChange(div); }, true); } div.fullScreenListener = true; } func.call(div); this.$doClick_(evt); } </attribute> </button> <menubar id="menubar"> <menu label="File"> <menupopup id="mpp"> <menuitem label="New" onClick="System.out.println(self.label);" /> <menuitem label="Open" onClick="System.out.println(self.label);" /> <menuitem label="Save" onClick="System.out.println(self.label);" /> <menuseparator /> <menuitem label="Exit" onClick="System.out.println(self.label);" /> </menupopup> </menu> <menu label="Help"> <menupopup> <menuitem label="Index" /> <menu label="About"> <menupopup> <menuitem label="About ZK" /> <menuitem label="About Potix" /> </menupopup> </menu> </menupopup> </menu> </menubar> </zk>
Asked: 2012-06-27 19:12:21 +0800
Seen: 213 times
Last updated: Jul 06 '12