We help IT Professionals succeed at work.

Click a Gallery Link on Page Load

I have a new development up and running and want to click a link in the gallery so that the proper images load when the page is loaded.

http://www.forgeinfinity.com/kreg/portfolio.html

At the Top of the page, under the black bar you will see all the categories, I want to be able to click these on page load... any scripts for this? I have tried everything!!!

I am trying to create a new HTML page for each item in the list and when I do that it shows all items until I click the category name, I want to do this automatically by triggering a click event.
Comment
Watch Question

Author

Commented:
Anyone, Anyone Buler ?
Most Valuable Expert 2013
Awarded 2012
Commented:
Hi,
the following code should do the trick:
$(document).ready(function() {
	$("ul.portfolio-categ").find("li").each(function() {
		$( this ).find("a").click();
	});
});

Open in new window


But I still do not understand why you want to run all that click events - this will definitely disturb your visitors.
HTH
Rainer

Author

Commented:
Actually I just want to run "ONE" click event. Which ever category page they selected from the menu. In the case of this example we could use - jigs,html but if I open that page, the gallery list defaults to the 'all' category. So I would like to trigger the click event "Kreg Jigs" I think I can modify the above code to do that correct?

So just so we are clear all I want to know is after page load, How do I click one of the items in the Gallery list at the top, like the "Kreg Jigs" link.

Author

Commented:
Tried this code in the head tag and it does trigger a click event, however the gallery dose NOT display the right product items? Any Thoughts ?


<script>
$(document).ready(function() {
	$("ul.portfolio-categ").find("li").each(function() {
		document.getElementById('jigs').click();
	});
});
</script>

Open in new window