Slider Revolution WP
09.27.2016
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
(function() { var grid = jQuery('.esg-grid'), url = window.location.href; if(!grid.length || url.search('#') === -1) return; var hash = url.split('#'); hash = hash[hash.length - 1]; if(!hash) return; hash = hash.toLowerCase().split(' ').join('-'); var timer = setInterval(function() { if(grid.is(':visible')) { clearInterval(timer); jQuery('div[data-filter=filter-' + hash + ']').trigger('click'); } }, 500); })(); |
Paste the code above into the “API/JavaScript” section of your Grid:
Then link to the filter using the filter’s title in the url. For example, if we wanted to link a filter named “portfolio”, here’s what the url would look like:
https://www.yoursite.com/grid-page/#portfolio
The script will automatically change filter titles to lower-case letters, and also replace spaces with dashes. So a filter named “My Filter” would become “my-filter”, and linked to like this:
https://www.yoursite.com/grid-page/#my-filter