View Full Version : Tab links fail on new image load from gallery.

02-24-2009, 12:31 AM
1) Script Title: Tab Content Script (v 2.2)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm

3) Describe problem:
After putting many hours into trying to figure out this problem I have decided it's time to seek advice.

The page I am having problems with displays an image along with a price list next to the image. The gallery software being incorporated into the website is only capable of displaying product prices in one long list (in a table dynamically generated). I have placed this price list/table in a ‘div’ (overflow hidden) and I am using Tab Content Script to force the content to scroll. When you click on a tab it appears as though a new price chart is being displayed. ( click on ‘Luster Prices’ tab…chart scrolls to luster price list. )

Code for reference:

<div id="product_type_wrapper">
<div id="product_nav" class="shadetabs">
<li><a href="#" rel="luster_price" class="selected">Luster</a></li>
<li><a href="#" rel="gloss_price">Glossy</a></li>
<li><a href="#" rel="canvas_price">Canvas</a></li>
<div id="price_chart_mask">
<div id="price_chart_wrapper">
<div id="price_chart">
<div id="luster_price" ></div>
<div id="gloss_price" ></div>
<div id="canvas_price" ></div>


<script type="text/javascript">

var products=new ddtabcontent("product_nav","price_chart")
products.setselectedClassTarget("link") //"link" or "linkparent"

When the page first loads and displays the 'image – price chart – tabs' all is fine and works well.

Here Is the Problem:
The page allows for you to advance to the next image in the gallery by clicking ‘next image’;

Code for reference:

<a id="ic_next" href="javascript:show_next_media('gallery_file_name={$GALLERY_FILE_NAME}&amp;id={$IMAGE_ID}&amp;category={$CATEGORY}&amp;mode=next')"><span>Next Image</span></a>

It’s at this point the tabs no longer function. Looking at the generated code, it appears that the script is not being executed when the new image is inserted.

Are there any ideas about what might be wrong?
Is there a better way of doing this?