Jump to content

How to URL jquery

This is kinda a noob question, but I am building a website and in one page I use a button to show/ hide some of the items on the page, like when I select projects it only shows the containers with the projects class, this code here:

 

$('#filter-buttons a').click(function(){

 
// select current
var $optionSet = $(this).parents('#filter-buttons');
   $optionSet.find('.selected').removeClass('selected');
   $(this).addClass('selected');
    
var selector = $(this).attr('data-filter');
$container.isotope({ filter: selector });
return false;
});

 

 

But I want to have links to this page like ...portfolio.html?projects,  ...portfolio.html?illustrations, ...... that when you load it loads with the URL it loads with the specific filter selected.

 

Link to comment
Share on other sites

Link to post
Share on other sites

If I understand your intentions correctly, I have something similar on the back burner

for a project of which I recently completed the first development and deployment state.

However, I have not yet implemented this, I've only done some research. Here's some

bits of what I've found so far: The most reasonable approach for modern browsers (well,

the only reasonable approach I know of) is to use phushstate and manipulating the browser

history.

Some stuff I've found while searching for my solution (I've not tried this yet myself,

but maybe it will be of some use to you):

http://www.youtube.com/watch?v=vNDjaTdqfBQ

a discussion about this on stackoverflow

and another one

DiveintoHTML

Since I'm currently a bit bored (waiting for parts for my build) I might investigate

further over the weekend. Sooner or later I'll need (well, want, really) to do something

like this myself anyway, might as well prepare properly now ;)

BUILD LOGS: HELIOS - Latest Update: 2015-SEP-06 ::: ZEUS - BOTW 2013-JUN-28 ::: APOLLO - Complete: 2014-MAY-10
OTHER STUFF: Cable Lacing Tutorial ::: What Is ZFS? ::: mincss Primer ::: LSI RAID Card Flashing Tutorial
FORUM INFO: Community Standards ::: The Moderating Team ::: 10TB+ Storage Showoff Topic

Link to comment
Share on other sites

Link to post
Share on other sites

I think the easiest way to approach this is PHP.

Ah, I think we have understood the question a bit differently :)

I thought the OP's intention was a partial page refresh which also changes the URL

(since if you just reload the page partially its URL would not be updated for the

appropriate subpage and you couldn't bookmark that subpage). This would not be

possible simply with PHP since PHP can only manipulate content at the server's side

and once it's sent out to the client PHP can't do anything anymore.

But yes, if it's only about passing parameters and not doing a partial page refresh

with javascript then PHP will be sufficient.

As a side note: Even if you do a partial page refresh, something like PHP on the server

side is probably still required to really get anything useful out of this.

BUILD LOGS: HELIOS - Latest Update: 2015-SEP-06 ::: ZEUS - BOTW 2013-JUN-28 ::: APOLLO - Complete: 2014-MAY-10
OTHER STUFF: Cable Lacing Tutorial ::: What Is ZFS? ::: mincss Primer ::: LSI RAID Card Flashing Tutorial
FORUM INFO: Community Standards ::: The Moderating Team ::: 10TB+ Storage Showoff Topic

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×