Reputation: 1
I've used clickable map and menu to show adresses of laboratories by paramenters (regions and profile) (here the site: http://ptgc-med.pl/index.php/dla-specjalisty/poradnie-genetyczne)
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):
<div id="filters">
<ul>
<li><a href="#" id="tagA">Diagnostyka prenatalna</a>
</li>
<li><a href="#" id="tagB">Zespoły wad rozwojowych</a>
</li>
<li><a href="#" id="tagC">Niepełnosprawność intelektualna</a>
</li>
</ul>
<div id="map-polska">
<ul class="polska">
<li class="pl1"><a href="#dolnoslaskie">Dolnośląskie</a>
</li>
<li class="pl2"><a href="#kujawsko-pomorskie">Kujawsko-pomorskie</a>
</li>
<li class="pl3"><a href="#lubelskie">Lubelskie</a>
</li>
</ul>
<div id="addresses">
ul>
<li id="podlaskie" class="tagA tagB"Podlaskie Centrum </li>
<li id="mazowieckie" class="tagA tagB tagC">Poradnia Genetyczna </li>
<li id="mazowieckie" class="tagG">Poradnia Genetyczna Instytutu Fizjologii</li>
</div>
My jquery code looks like this:
$(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();
});
});
May be it's stupid question, but I've just got lost... I will be really greatefull for any help!!!
Upvotes: 0
Views: 412
Reputation: 7320
On the click event just add
$(document.body).animate({'scrollTop':$('div#addresses').position().top},1000);
you will have a smooth scrolling to the #addresses
div
if you want just a simple solution just write
location.href = "#addresses"
Upvotes: 2