I am using a jQuery portfolio which filters the gallery when a drop down menu selection activates an onclick event.


It uses the following code to filter the selection:

$(document).ready(function() {

$('ul#filter a').click(function() {


$('ul#filter .current').removeClass('current');


var filterVal = $(this).text().toLowerCase().replace(/ /g,'-');

var itemsLength = $('ul#portfolio li:visible').length;

$('ul#portfolio li:visible').each(function(i) {

$(this).fadeOut('slow', function(){if(itemsLength == ++i){show(filterVal);}});


return false;



function show(filterVal){

if(filterVal == 'all') {

$('ul#portfolio li').fadeIn('slow');

} else {

$('ul#portfolio li').each(function() {

if($(this).hasClass(filterVal)) {





I want the page to, when opening, filter the gallery to the
<li class="current">
in the filter
<ul id="filter">
. Can this be done using window.onload?

I am an absolute beginner so any help would be appreciated!