Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    One Script overwriting another

    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:

    Code:
    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:

    Code:
    $(document).ready(function(){
    
    	$(".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...
    Code:
    <script type="text/javascript">
    window.onload = function() {
    showonly(thechosenone);
    makeScrollable(wrapper, scrollable);
    }
    </script>
    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/
    Last edited by Sharp161; 08-20-2010 at 09:15 PM.

  • #2
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Bump: no one got any ideas? Completely stumped!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •