Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to jump to filter results on page using jquery?
    text
    copied!<p>I've used clickable map and menu to show adresses of laboratories by paramenters (regions and profile) (here the site: <a href="http://ptgc-med.pl/index.php/dla-specjalisty/poradnie-genetyczne" rel="nofollow">http://ptgc-med.pl/index.php/dla-specjalisty/poradnie-genetyczne</a>)</p> <p>The problem is how to make that when I click on a region, it jumps to the beginning of paragraph with filtered results, because now mwhen results are show you still see the map. I've used jquery to filter these laboratories, and html looks like this (it's short version): </p> <pre><code>&lt;div id="filters"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#" id="tagA"&gt;Diagnostyka prenatalna&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#" id="tagB"&gt;Zespoły wad rozwojowych&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#" id="tagC"&gt;Niepełnosprawność intelektualna&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p></p> <pre><code>&lt;div id="map-polska"&gt; &lt;ul class="polska"&gt; &lt;li class="pl1"&gt;&lt;a href="#dolnoslaskie"&gt;Dolnośląskie&lt;/a&gt; &lt;/li&gt; &lt;li class="pl2"&gt;&lt;a href="#kujawsko-pomorskie"&gt;Kujawsko-pomorskie&lt;/a&gt; &lt;/li&gt; &lt;li class="pl3"&gt;&lt;a href="#lubelskie"&gt;Lubelskie&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p></p> <pre><code>&lt;div id="addresses"&gt; ul&gt; &lt;li id="podlaskie" class="tagA tagB"Podlaskie Centrum &lt;/li&gt; &lt;li id="mazowieckie" class="tagA tagB tagC"&gt;Poradnia Genetyczna &lt;/li&gt; &lt;li id="mazowieckie" class="tagG"&gt;Poradnia Genetyczna Instytutu Fizjologii&lt;/li&gt; &lt;/div&gt; </code></pre> <p>My jquery code looks like this: </p> <pre><code>$(document).ready(function(){ $('#filters a').click(function(e){ e.preventDefault(); var filter = $(this).attr('id'); $('#addresses ul li').show(); $('#addresses ul li:not(.' + filter + ')').hide(); }); </code></pre> <p>}); </p> <p>May be it's stupid question, but I've just got lost... I will be really greatefull for any help!!!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload