m_johnson — 2011-04-26T08:37:45-04:00 — #1
I am trying to create tabs with content using jquery ui, where both the tabs and content share one background image, as seen in the image below.
And click on each tab changes the background to its corresponding image.
I am a bit lost on this, so any idea how this can be achieved in terms of div and css, with or without jquery?
Many thanks in advance!
kokos — 2011-04-26T08:43:39-04:00 — #2
One way you could do it, is make the content div extend to the top of the tabs and give it a top padding to make sure the content starts below the tabs.
Then make the active tab transparent, and give the other tabs a background color, as well as adding a white div in between the tabs to hide the rest of the background.
m_johnson — 2011-04-26T10:09:03-04:00 — #3
Things get a lot trickier once you add rounded corners to both the tabs and the content.
picnictutorials — 2011-04-26T10:32:56-04:00 — #4
I would first probably attempt to just position the same image in each tab. By using background position you should be able to position it pixel perfect.
kokos — 2011-04-26T10:41:35-04:00 — #5
I didn't think of that, that's probably a much better solution.
picnictutorials — 2011-04-26T11:01:54-04:00 — #6
paulob — 2011-04-26T11:25:01-04:00 — #7
I'd do it much like Eric said and here's a quick (rough and ready) demo. (Excuse the jquery but it would take me to long to do it manually) :).