The idea is to create four triggers (four div's) to display four areas with content related to that trigger. For example imagine the first trigger as "about us", if you click on it an area with the story of the company must appear.
However I am working with background designs in the triggers, the first trigger must be "on" when the page load, so the first trigger has an arrow (as a background image desing) pointing to the area below. When you click the next trigger, the background of the first trigger must return to the "close-background-design" and the background of the clicked one must change to the arrow pointing to the new content that shows.
Seems to be easy, however it's very tricky to me.
All four divs (triggers) has a class:
- .pestanas {
- other styles...
- background-image: url(../images_b/pestana_ultimate.png);
- }
This is the design of the non-arrows.
Every four triggers have their own ID's with the idea of controling when must appear the arrow in the click event.
- #pestana_a {
- styles...
- }
- #pestana_b {
- styles...
- }
- #pestana_c {
- styles...
- }
- #pestana_d {
- styles...
- }
This is the Jquery:
- $('.pest_area').hide(); //four areas with four contents must be hide at loading
- $('#pest_a').show(); //the first area must be shown at loading.
- $('#pestana_a').css('background-image', 'url(images_b/pestana_arrow.png)'); //the first arrow must be shown at loading in the first trigger
- $('.pestanas').click(function() {
- var clicked=$(this).attr('id').split("_")[1]; //pestana_ + [a]
- var idObj=$(this).attr('id');
- $(idObj).css('background-image', 'url(images_b/pestana_arrow.png)'); //this is not working
- var areaID='#pest_' + clicked;
- $('.pest_area').hide();
- $(areaID).show();
- });