Tab click changes DIV Background Image


is it possible to change a DIVs background image by clicking on TAB?
I want to habe the TAB navigation in front of a image. This image should
change every time i click on the TAB.

I appreciate every good tipp.


Should it be the only content to be changed when you click on that tab?


TAB1 (active) TAB2 TAB3



TAB1 TAB2 (active) TAB3



Correct, that is how it should react.
Important is that the Image stands behind the TAB Navigation.

best kai

Ooh I’ve seen this done on a few websites recently and loved the feel. I’m assuming a click interaction or even a hover interaction affecting the div background element. Not sure how to call up a different image though.

Do you have any reference?

If its not within the corresponding tab content element, i think its only possible with the use of javascript. But no big deal.

Can give you an example on monday.


Thanks, here i have the reference.

I thought of changing the bg-img class, but maybe there will be an more easier way to archieve the effect.


I m sick so I cant be online yesterday.

The only way im my oppinion is to do it either with jquery or java.

Lets set it up like this:
Lets pretend you have a standard background image and want to change it when you click on the second tab.

First, lets build the elements like you did in your example and apply three IDs to the
a) element that holds the bg image
b) + c) the two tabs that will change the class of the bg image div.

Your custom head code will look like this:

<style type="text/css">
    .bg1{ background-image: url(;}

And your body code like this:

$(function () {
    $("#tab1").click(function () {
$(function () {
    $("#tab2").click(function () {

That should do the trick.
If you have more than two tabs you will have to change the jquery slightly, so that it will not just remove a class but remove one and add another. You ll have to define every class within the css (every bg image gets another class).

Should work, if not feel free to reply.

You can see it live here:


1 Like

Thanks, this works very good.


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.