12 years 9 months ago #123905
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- hover an image over item image
hover an image over item image
Y
12 years 9 months ago #123906
First of all you will have to add the transparent image somewhere in the code and specifically right under the <img> element of the itemImageBlock container.
Then with some css place the transparency right above the image.
You can ask your template developer/provider in order to help you with this.
Don't forget to use the K2 template overrides in order to make the modification required in the item.php file or the category_item.php file.
Then with some css place the transparency right above the image.
You can ask your template developer/provider in order to help you with this.
Don't forget to use the K2 template overrides in order to make the modification required in the item.php file or the category_item.php file.
Topic Author
12 years 9 months ago #123907
thank you for your prompt response here is the code in item.php and the css - where would you put the transparent image and would css need editing?
Y
12 years 9 months ago #123908
Put a <span class="hoverImg"> </span> right under the <img> element in the code you have provided.
Then all else should be made with CSS.
Add to .itemImageBlock a, a position:relative;
and the css for the hoverImg
.itemImageBlock a span.hoverImg {opacity:0; width:100%; height:100%; display:block; position:absolute;top:0;left:0;background:#000;}
.itemImageBlock a:hover span.hoverImg {opacity:0.4;}
If you want to remove the current effect from your image, remove the css
.itemImageBlock:hover img{
-webkit-transform:scale(1.06);
-moz-transform:scale(1.06);
-ms-transform:scale(1.06);
-o-transform:scale(1.06);
transform:scale(1.06);}
Then all else should be made with CSS.
Add to .itemImageBlock a, a position:relative;
and the css for the hoverImg
.itemImageBlock a span.hoverImg {opacity:0; width:100%; height:100%; display:block; position:absolute;top:0;left:0;background:#000;}
.itemImageBlock a:hover span.hoverImg {opacity:0.4;}
If you want to remove the current effect from your image, remove the css
.itemImageBlock:hover img{
-webkit-transform:scale(1.06);
-moz-transform:scale(1.06);
-ms-transform:scale(1.06);
-o-transform:scale(1.06);
transform:scale(1.06);}
Topic Author
12 years 9 months ago #123909
thank you for your help! I've done this on localhost and it works a treat!!
One last problem I have is it works on individual item page - but not on the category list... any ideas where I'd put <span class="hoverImg"></span> ??
Thank you for your help!
One last problem I have is it works on individual item page - but not on the category list... any ideas where I'd put <span class="hoverImg"></span> ??
Thank you for your help!
Y
12 years 9 months ago #123910
Just locate the similar block of catItemImageBlock in category_item.php and put it right under the img of that block. Then adjust the css to work on the listing as well.
Topic Author
12 years 9 months ago #123911
Hi, yeah I tried that - but it doesn't seem to work - the <a class="itemImage" is different, in the item it reads <a class="modal" - would that have anything to do with it?
Y
12 years 9 months ago #123912
Keep both classes. Separate them with a space between them. The item needs the modal class so when the image is clicked to open in a modal window.
Topic Author
12 years 9 months ago #123913
Ignore last comment! I got it sorted now!! :)
Thank you for all your help!
Thank you for all your help!
Topic Author
12 years 9 months ago #123915
final question - which file do I put the <span class="hoverImg"></span> in for the homepage items?? Everything else is working!
Thanks!
Thanks!
Y
12 years 9 months ago #123916
Since your homepage is a link to Latest items from category, you should put the span element in latest_item.php file of your overrides.
Topic Author
12 years 9 months ago #123917
Yeah - I put it here, doesnt seem to want to work - does it require a CSS edit?
Y
12 years 9 months ago #123918
Probably. Check if you have the css declarations for .itemImageBlock under different containers.
Do you have it on the live site so I can check it out?
Do you have it on the live site so I can check it out?
Topic Author
12 years 9 months ago #123919
Hi!
Its all sorted thank you for your support and help on this
Much appreciated!
Its all sorted thank you for your support and help on this
Much appreciated!
Log in or create an account to reply.