Making background image clickable

GK User
Wed Apr 21, 2010 2:17 pm
I want to use the background image as an adspot; outside of the template frame.

Anyone know how to make the background clickable?

Thanks,
Tony
User avatar
Senior Boarder

GK User
Thu Apr 22, 2010 2:29 pm
Sounds interesting, I am waiting for an answer..
User avatar
Gold Boarder

teitbite
Fri Apr 23, 2010 2:23 pm
Hi

I have one idea for this, but think it's not a good one.

1. Create a layer which cover the whole page and set background to it. Also set this layout position:relative
2. Put <a href></a> into it
3. Put <img /> as clickable element but for image please use 1px x 1px transparent png picture and resize it in img style to cover the whole site
4. Set the main layer of the page as position:absolute

Crazy but may work.
User avatar
Moderator

GK User
Fri Apr 23, 2010 3:18 pm
That might just work; I will give that a whirl.

Thanks
User avatar
Senior Boarder

GK User
Fri Apr 30, 2010 3:28 pm
Hey Piotr,

I tried your method; but I don't think I did a very good job of it because I could not get it work.

I tried this:
(css)
#siteWrapper{
margin:0 auto;
top:0px;
z-index:-9999;
}
html:
<div id="siteWrapper" onclick="window.open('http://www.joomlaviews.com')" style="cursor:pointer;">


And although it works; I cannot get the z-index to work and essentially the entire page becomes one big link, even inside the siteframe in the middle.

Any ideas?
User avatar
Senior Boarder

teitbite
Sun May 02, 2010 2:07 pm
Hi

z-index works only for positioning layers, so please try to add some css styles like:

Code: Select all
position:relative;
position:absolute;
position:fixed;     <-- may look good for the background


Please experiment with this.
User avatar
Moderator

GK User
Sun May 02, 2010 5:49 pm
Hi

I have been messing with that for the last couple of hours and I am just making myself truly even more confused; when I changed the positioning; even with a z-index of -9999, it would put a non-clickable sheet over the entire site including the sides; without the positioning, the entire site would be background clickable, if you moused over the menu and clicked on an item, it would both go to the menu you clicked on AND to the background destination (two clicks for the price of one kind of).

With the positioning added, nothing was clickable, not the background or the site itself but it would scroll up and down with the mouse.

I am clearly outside my comfort zone here, so I created a scriptlance project: http://www.scriptlance.com/projects/127 ... ref=brichi

Let's see if someone can help me out with it.

Thanks though!
User avatar
Senior Boarder

teitbite
Tue May 04, 2010 12:51 pm
Hi

Try maby put the site out from the clickable layer and stright the layer with css and than try z-index.
User avatar
Moderator


cron