0

Problem With Parent of the Menupopup in Fullscreen

asked 2012-06-27 19:12:21 +0800

interacthb gravatar image interacthb
78

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.

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2012-06-28 02:03:30 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

Please post your example to the ZK Bug Tracker.

link publish delete flag offensive edit

answered 2012-06-28 11:46:49 +0800

interacthb gravatar image interacthb
78

updated 2012-06-28 11:47:22 +0800

Posted: http://tracker.zkoss.org/browse/ZK-1226


Thank you

link publish delete flag offensive edit

answered 2012-07-06 07:35:52 +0800

benbai gravatar image benbai
2228 6
http://www.zkoss.org

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>

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-06-27 19:12:21 +0800

Seen: 213 times

Last updated: Jul 06 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More