Click, load page, then do something depending on what was clicked
-
Hi. I’m working on a child theme of Twenty Thirteen – https://mrem.byethost9.com/ – using Isotope (https://isotope.metafizzy.co/).
The website is for an illustrator and I’m using Isotope to filter through her works, that are displayed on the home page. I’ve got that part working with two menus that are filters – “ilustra??o” and “oficinas”, each with their own sub-menus, that are also filters. This part is working.
When I go into another page, like “contactos”, however, this complicates things. If I click the filters, I need first to return to the homepage and then filter the posts. I can only do the first part, like this://filterMenuItems contains the menu items that will filter the posts. filterMenuItems.each( function (index) { var itemLink = $(this).children("a"); itemLink.click( function() { if (!isThisHome()) { //if we're not currently on the homepage, where filtering happens, then go to home page. window.location.href = urlHome; } filterPosts(this); //function that does the filtering. });
What I need is to check, each time the home page is loaded, if it came from a different page, and if so, what menu-item was clicked. If it was a filter menu item, then it needs to filter the posts. I’m guessing this is possible with some sort of event listener, but I’m not sure how to do that part. Can anyone give me a hint?
Thank you.
- The topic ‘Click, load page, then do something depending on what was clicked’ is closed to new replies.