View Single Post
08-04-2008, 11:30 AM
#4
Avarus is offline Avarus
Avarus's Avatar
Status: Junior Member
Join date: Aug 2007
Location: Apeldoorn, The Netherlands
Expertise:
Software:
 
Posts: 29
iTrader: 0 / 0%
 

Avarus is on a distinguished road

  Old

Cool, I've never heard of jQuery, I'll try this first.

Thanks for your replies

EDIT:

I've tried a script from this site: http://enure.net/dev/hide-all-except-one/. It seems to be exactly what I am looking for, except the point that it gives an error.

I've used this example:

Code:
<a href="#lorem" class="toggle">lorem</a>
<a href="#ipsum" class="toggle">ipsum</a>

<div id="toggleThis">
   <div id="lorem">
      lorem
   </div>
   <div id="ipsum">
      ipsum
   </div>
</div>
This is the main code:

Code:
$(document).ready(function() {
    var hash = window.location.hash;
    
    (!hash) ?  
        hideAllExcept('#' + $('#toggleThis > div:first').attr('id')) 
            : hideAllExcept(window.location.hash);

    $('a.toggle').hover(function() {
        var href = $(this).attr('href');
        hideAllExcept(href);
    });
});

function hideAllExcept(el) {
    $('#toggleThis div').addClass('hide');
    $(el).removeClass('hide');

    $('a.toggle').removeClass('active');
    $('a[href="' + el + '"]').addClass('active');
    
}
This is the error:

Code:
Message: 'guid' is null or not an object
Line: 1835
Char: 3
Code: 0
Since I've been in jQuery for like 1 hour, I've no idea what is going wrong