I used a filterable gallery example from netuts and it works great. If you visit the page you can click on 'illustration' or 'animation' and only show items relating to that. My question is can I have an 'illustration' link on another page that'll load the index.html auto showing only illustration items (for example)?

2 answers

o.k.w 2355

You can insert the following code snippet into your jQuery ready function, e.g. within /js/framework.js file.

$('ul#filter a').each(function(index){
  if('#' + $(this).text()==location.hash) //tweak this line if you want to replace special characters e.g. spaces with dash etc

So to have "illustration" filtered, navigate to index.html#illustration.

Answered about 9 years ago by o.k.w
  • Not really au fait with tinkering with the .js files - do I just add that on the end? Liam Brazier about 9 years ago
  • I have added that snippet to the end of the framework.js and if you check www.liambrazier.com/test/store I am testing the links in the top menu back to the root index page. Doesn't seem to be working(?) Liam Brazier about 9 years ago

Being unfamiliar with it, can I presume the problem lies somewhere in the javascript? Currently if you try and click the illustration or animation links on the 'store' page to return to the index page they don't even function as links, let alone filter.

Any one have a solution?

Answered about 9 years ago by Liam Brazier