0

Issues Regarding MouseOver Event in Zkoss for Div or Image IE 8 and IE 9

asked 2012-07-31 16:37:03 +0800

rishi11 gravatar image rishi11
9

Hello Everyone,

Below is my code which is not working for IE 8 and IE 9 browsers

Div preButtonDiv = new Div();
String imgSrc = Sessions.getCurrent().getWebApp().getRealPath("images/slideshow/previous.png"); // this is the image source path
AImage preAImg = new AImage(imgSrc);
Image preImage = new Image();
preImage.setContent(preAImg);
preButtonDiv.appendChild(preImage);

preImage .setVisible(false);
preButtonDiv.addEventListener(Events.ON_MOUSE_OVER, new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
preImage .setVisible(true);
}
});

In Above code "nextImage.setVisible(true);" This is not working .For Events.ON_MOUSE_OVER
"Events.ON_MOUSE_OVER " is not call in this case for IE8, IE 9 Browsers

Please Suggest
rishi

delete flag offensive retag edit

2 Replies

Sort by » oldest newest

answered 2012-07-31 21:13:04 +0800

twiegand gravatar image twiegand
1807 3

updated 2012-07-31 21:15:35 +0800

rishi,

When posting code here, please use the [code] [/code] block.  It makes it easier for users of this forum to read.  You can also click the # button just under the Preview tab when editing your post.

A couple of things:
     1)  I don't see (and maybe you just didn't include all the code) where preButtonDiv is ever attached to a parent component
     (like a <window>)
     2)  You may need to have something actually in the preButtonDiv (like some text or at the very least a non-breaking space).
     Otherwise, the event probably won't fire.

To illustrate, I modified your example slightly (used an existing image since I can't see your server and added some text in the div):

<zk>
	<zscript>
		import org.zkoss.zk.ui.util.GenericForwardComposer;
		
		public class myController extends GenericForwardComposer {
		
			Window win;
			public void doAfterCompose(Component comp) throws Exception {
				super.doAfterCompose(comp);
				
				Div preButtonDiv = new Div();
				Image preImage = new Image();
				preImage.setSrc("http://www.zkoss.org/zksandbox/img/msn1.gif");
				preButtonDiv.appendChild(new Label("mouse over here"));
				preButtonDiv.appendChild(preImage);
				win.appendChild(preButtonDiv);
				preImage.setVisible(false);
				preButtonDiv.addEventListener(Events.ON_MOUSE_OVER, new EventListener() {
					public void onEvent(Event event) throws Exception {
						preImage.setVisible(true);
					}
				});
			}
		}
	</zscript>
	<window id="win" apply="myController">
	
	</window>
</zk>

Give the above a try in your environment and I think you'll see that it works (I tested in IE 9, Chrome, and FF 14).

Hope that helps,

Todd

link publish delete flag offensive edit

answered 2012-08-06 09:02:09 +0800

rishi11 gravatar image rishi11
9

Hi Todd

My current code is perfectly working proper in IE 8 , 9 browser.

Thanks
rishi

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-07-31 16:37:03 +0800

Seen: 175 times

Last updated: Aug 06 '12

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