Greetings to all. I have on my page a filter of this type:

<div class="filter_outer"> <div class="filter_holder"> <ul> <li class="label"><span data-label="Фильтр">Фильтр</span><i class="icon-angle-down"></i> <div class="arrow"></div> </li> <li class="filter active" data-filter="all"><span>Все</span> </li> <li class="filter" data-filter="event"><span>Event</span> </li> <li class="filter" data-filter="main"><span>Разделы</span> </li> </ul> </div> </div> 

How to make it so that I can access this page from the outside by clicking on a link already with a specific filter for a specific section of an event - of the form: <a href="[http://ссылка/(data-filter=event)]">ссылка</a> 1 ? If conditions are not enough or you don’t know how - a big request is not a bad thing! and just tell me about it pliz

  • Someone would only have to minus it ... I after all gave a minimal example, in my opinion a very specific question. if it cannot be done this way, then tell me - what are the minuses right away ?? ... - Vasya
  • " This question does not reflect the desire to understand; it is not clear or not useful " (From the tooltip on the "down" button). - Dmitriy Simushev
  • one
    " Does not reflect the desire to understand " + "is not good ." As for the minimal example, the code given in the question is not . I can't stick it in JSFiddle and get to reproduce the problem. - Dmitriy Simushev
  • one
    @ Vasya Add details to the question. What filters this filter and how? Give the Javascript code and specify what you tried to do so that it responds to the request parameters. - tutankhamun
  • one
    The question is too general and you will hardly have a specific answer to it. 1) You can specify parameters in the GET link, and on the page, depending on the parameters passed, perform the actions you need (parse the URL and do what your heart desires). 2) When filtering, any normal filter adds its parameters to the address bar, which allows you to keep the fitra active when the page is reloaded, if your filter has this, then you can figure out which parameters the filter generates and substitute your own. - walik

2 answers 2

Varinat 1

Rewrite the filter to normal form using GET parameters and links like

 <a href="http://ссылка?filter=event">ссылка</a> 

Option 2

Either a crutch on js with a hash in url:

 $(function(){ // document ready var filter = window.location.hash.replace('#', ''); $('.filter[data-filter="' + filter + '"]').click(); // если у вас есть событие на клик }); 

Link will be kind

 <a href="http://ссылка#event">ссылка</a> 

    I have a similar problem. And the essence is most likely in something simple.

    There is a page where blocks are filtered. It was easier (many times) to create 7 different pages. But it was interesting for me to bring the matter to the end in this way. Maybe now I will redo it ....

    Here is the original page https://sibirpotok.ru/service.html

    On the left are listed services. When we go to the page all the blocks on the same page. If you click on the menu on the left - the desired block is filtered. It is necessary to imitate that the pages are different. Even if the page is updated, you need to automatically run the script to stay in the same menu item. Otherwise, all the blocks on the same page will fall out again.

    I can’t start the buttons even on the same page through the top drop-down menu. And still it is necessary to make start of buttons upon transition from other pages, through the drop-down menu from above.

    That's what's on the filter in the jackpot.

      // filter items when filter link is clicked $('#filtrable a').on('click', function(e) { var selector = $(this).attr('data-filter'); $container.isotope({ filter: selector, layoutMode : 'fitRows' }); // return false; e.preventDefault(); }); var $optionSets = $('#filtrable li'), $optionLinks = $optionSets.find('a'); $optionLinks.on('click', function(e){ var $this = $(this); // don't proceed if already selected if ( $this.hasClass('selected') ) { // return false; e.preventDefault(); } var $optionSet = $this.parents('#filtrable'); $optionSet.find('.selected').removeClass('selected'); $this.addClass('selected'); // make option object dynamically, ie { filter: '.my-filter-class' } var options = {}, key = $optionSet.attr('data-option-key'), value = $this.attr('data-option-value'); // parse 'false' as false boolean value = value === 'false' ? false : value; options[ key ] = value; if ( key === 'layoutMode' && typeof changeLayoutMode === 'function' ) { // changes in layout modes need extra logic changeLayoutMode( $this, options ) } else { // otherwise, apply new options $container.isotope( options ); } // return false; e.preventDefault(); }); // $(function(){ 

    // // var hash = location.hash.substr (1) // $ ('[data-value = "' + hash + '"]'). click (); // //});

      $(function(){ var filter = window.location.hash.replace('#', ''); $('.filter[data-filter="' + filter + '"]').click(); // если у вас есть событие на клик 

    });

     })(jQuery); 

    At the very bottom, I tried to add the jQuery code I found here. Maybe not add there or not)))

    And still tell me where it can be, there are ready-made templates according to the principle to make. And the most important thing is that hosting like a java script does not support.