0

Image is not "clickable"

asked 2010-05-31 15:18:39 +0800

shreesony gravatar image shreesony
15

I have below code in .zul file
<image sclass="myimg" width="100px" height="80px" src="/img/rasp/File-icon128.png"
forward="onClick=onThumbnailClick(${each.id})" />

and the above image is in a Grid row. This works properly and when i click on the image it invokes the method onThumbnailClick() as well. The only issue is that, in the browser when i move the mouse over the image it does not change the mouse pointer to "palm" indicating that it a cliackable image. How do I visually indicate that its a clickable item? I have this issue in many images and not sure if its because of the event "forward"s.

thanks,
Shreesony

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2010-05-31 15:30:49 +0800

vinhvo gravatar image vinhvo
369 3

Can you use toolbar button and set its image property?

link publish delete flag offensive edit

answered 2010-05-31 15:41:08 +0800

shreesony gravatar image shreesony
15

I'm using ZK 3.6.3. Is there a way to specify image's width and height using toolbarbutton?

link publish delete flag offensive edit

answered 2010-05-31 16:35:32 +0800

vinhvo gravatar image vinhvo
369 3

Does it work if you specify width and height for Toolbar button ?
Otherwise, we can go back to your image : by adding extra css properties : on hover : something
Refer this for adding extra css.

link publish delete flag offensive edit

answered 2010-06-01 00:07:22 +0800

shreesony gravatar image shreesony
15

It doesn't work when toolbar's height and width are specified. Looked at the pointers on "adding extra css"; but couldn;t make out. Could you help me with any example of achieving this with css?

link publish delete flag offensive edit

answered 2010-06-01 01:36:24 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

Hi shreesony,
Try this

<style> 
		.myimg{ 
			cursor:pointer;
		}
	</style>

Thanks
- Ashish

link publish delete flag offensive edit

answered 2010-06-01 01:41:16 +0800

gekkio gravatar image gekkio flag of Finland
899 1
http://gekkio.fi/blog

You can wrap your image inside an <a></a> element or use extra CSS like vinhvo suggested.

The CSS solution is to use cursor: pointer.
For example:

<image src="pic.png" style="cursor: pointer" />

(or even better, use a CSS class with cursor: pointer and just assign the class to your images)

Sometimes I prefer the <a></a> solution because you can then use :hover styles correctly.
(:hover CSS definitions work only on A tags in IE6).

For example if you'd like to add borders to your image on hover:

Doesn't work in IE6:

<style>
  .myimg:hover {
     border: 1px solid #777;
  }
</style>
<image sclass="myimg" src="pic.png" forward="..." />

Works in IE6:

<style>
  a.myimgwitha:hover {
     border: 1px solid #777;
  }
</style>
<a sclass="myimgwitha" forward="...">
  <image sclass="myimg" src="pic.png" />
</a>

(Don't use <style></style> tags in real world code, use a separate CSS file instead)
Also, if you're using ZK 3.6, you'll have to use the HTML namespace for the A tag because there is no ZUL component called A.

link publish delete flag offensive edit

answered 2010-06-01 01:45:41 +0800

shreesony gravatar image shreesony
15

Ashish, Gekko,

Fantastic!! Both the solutions worked. Thanks a lot and really appreciate your help.

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: 2010-05-31 15:18:39 +0800

Seen: 427 times

Last updated: Jun 01 '10

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