View Full Version : One Script overwriting another

08-20-2010, 09:43 PM
Hi all, Im still learning as i go here so please bare with me. Im completely stuck any help would be greatly apreciated.

I have two scripts 1 to hide or show a large div in the middle of the page. Inside each of these hidden divs is a small gallery with 2 thumbnails using another script.

both scripts work fine until you click a thumbnail it loads its larger image as it should however at this point the other script seems to be overwritten and doesnt work properly.

Heres the showonly script for the hidden divs:

function showonly(thechosenone) {
var shoediv = document.getElementsByTagName("div");
for(var x=0; x<shoediv.length; x++) {
name = shoediv[x].getAttribute("name");
if (name == 'shoediv') {
if (shoediv[x].id == thechosenone) {
shoediv[x].style.display = 'block';
else {
shoediv[x].style.display = 'none';

Heres the code for the thumbnail gallerys:


$(".viper_stone_thumbs a, .viper_black_thumbs a, .titan_cuoio_thumbs a, .titan_black_thumbs a, .pheonix_taupe_thumbs a, .hawk_taupe_thumbs a, .hawk_black_thumbs a, .falcon_cuoio_thumbs a, .bison_stone_thumbs a, .bison_black_thumbs a").click(function(){

var largePath = $(this).attr("href");
var largeAlt = $(this).attr("title");

$("#viper_stone_img_id, #viper_black_img_id, #titan_cuoio_img_id, #titan_black_img_id, #pheonix_taupe_img_id, #hawk_taupe_img_id, #hawk_black_img_id, #falcon_cuoio_img_id, #bison_stone_img_id, #bison_black_img_id").attr({ src: largePath, alt: largeAlt });

$("h2 em").html(" (" + largeAlt + ")"); return false;


I'v tried adding...

<script type="text/javascript">
window.onload = function() {
makeScrollable(wrapper, scrollable);

but im guesing thats not the issue as the problem accurs later in the script? I also tried giving each hidden div its own individual name using the || parameter.

Anyone got any clues where iv gone wrong? Its making my head hurt! :-(

EDIT: Oh heres the site you can see it all working... http://www.exceedshoes.eu/

08-23-2010, 12:36 PM
Bump: no one got any ideas? Completely stumped!