CSS & jQuery clickable map


  // invoke function with specified size and floating tooltips;
    'size' : 810, 				// set map size;
    'tooltips' : 'floating' 	// floating tooltips;


    'size': 660,		// set map size to 660px wide;
    'tooltips': false,	// hide tooltips;
    'cities': true		// display cities;


    'size': 500, 			// set map size to 500px wide;
    'multipleClick': true, 	// enable Multiple Click mode;
    'clicksLimit': 3, 		// three clicks limit; 
    'searchLink': 'Szukaj'	// rename search button;


    'size': 340,  						// set map size to 340px wide;
    'visibleList': true, 				// show list of regions (customzied list shown);
    'cities': true,						// display cities;
    'tooltips': 'floating-bottom-right'	// floating tooltips with specified position to the mouse pointer;

/* list of regions can be placed next to the map by these sample CSS rules: */

  width: 545px; /* must be a sum of the map and visible list widths and paddings */
.m340 .css-map,.m340 .map-visible-list{
  display: inline-block; /* for IE7 use display:inline; zoom:1; */
  vertical-align: top;
.m340 .map-visible-list{
  margin-left: 20px;
.m340 .map-visible-list li{ width: 100%; }

  // sample usage of the onClick and onHover options (click on the map to run onClick function)
    'size': 500,					// set map size to 500px wide;
    'onClick': function(e){
      var link = e.children('a').attr('href'),		// get link's URL; 
          text = e.children('a').eq(0).text(),		// get text of the link; 
          className = e.attr('class').split(' ')[0];	// get class name of the list item; 


Basic knowledge of the HTML, CSS and Photoshop is required for a proper installation and customization of the map!

Setup and settings

Link files

In the <head> tag of your page add link to the style sheets and scripts. The CSS file must be loaded before scripts and links directly to the folder with maps.

<link rel="stylesheet" type="text/css" media="screen,projection" href="cssmap-poland/cssmap-poland.css" />

Now link to the jQuery library* (if it hasn't been yet) and the map core script**

<script  type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
 <script type="text/javascript" src="http://cssmapsplugin.com/4/jquery.cssmap.js"></script> 

Finally you can initialize the cssMap(); function with a specified map size:

<script type="text/javascript">
    $('#map-poland').cssMap({'size' : 810});

* the map requires jQuery 1.6 and higher, but you should always use the recent version!

** the script is stored in the Cloud, so you'll always have an access to the latest version. Load it only once even if you're using multiple maps on the one page.

The markup

Place following list of regions somewhere in the <body> tag of your page (or into post/article content).
The id attribute of the map container can be set as you want, but don't edit class names in the list. The CSS targets that classes specifically. Of course you can change the links and names of regions.

view plain

<div id="map-poland">
 <ul class="poland">
  <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>
  <li class="pl4"><a href="#lubuskie">Lubuskie</a></li>
  <li class="pl5"><a href="#lodzkie">Łódzkie</a></li>
  <li class="pl6"><a href="#malopolskie">Małopolskie</a></li>
  <li class="pl7"><a href="#mazowieckie">Mazowieckie</a></li>
  <li class="pl8"><a href="#opolskie">Opolskie</a></li>
  <li class="pl9"><a href="#podkarpackie">Podkarpackie</a></li>
  <li class="pl10"><a href="#podlaskie">Podlaskie</a></li>
  <li class="pl11"><a href="#pomorskie">Pomorskie</a></li>
  <li class="pl12"><a href="#slaskie">Śląskie</a></li>
  <li class="pl13"><a href="#swietokrzyskie">Świętokrzyskie</a></li>
  <li class="pl14"><a href="#warminsko-mazurskie">Warmińsko-mazurskie</a></li>
  <li class="pl15"><a href="#wielkopolskie">Wielkopolskie</a></li>
  <li class="pl16"><a href="#zachodniopomorskie">Zachodniopomorskie</a></li>
Do not copy anything from the source code of this demo page!

Adjust map to your needs

List of all script options available to customize the map (default values listed):

size : 810,					// String: map width (must be set); availalbe sizes: 170, 240, 270, 340, 500, 660 and 810;
tooltips : "sticky",		// String: "sticky" - display tooltip in the center of the region;
							// String: "floating" - tooltip follows the mouse pointer; position to the cursor: "floating-top-center" (default), "floating-bottom", "floating-left", "floating-right", "floating-middle-left", "floating-bottom-right" etc;
							// String: "hidden" - hidden tooltips;
							// String: "visible" - always visible tooltips (can be use to show number of item in each region for example);
tooltipArrowHeight : 5,		// Integer: height of the arrow under the tooltip; is set by border-width of the .css-map li a .tooltip-arrow;
cities : false,				// Boolean: display cities on the map;
visibleList : false,		// Boolean: show a list of regions;
loadingText : 'Loading ...',// Sting: text of the preloader; HTML tags allowed;

// Multiple Click mode
multipleClick : false,	 	// Boolean: Multiple Click mode;
searchUrl : 'search.php',	// String: URL to the search engine; in the Multiple Click mode search link is displayed under the map;
searchLink : 'Search',	 	// String: Name of the search link;
searchLinkVar : 'region',	// String: variable passing to the search engine;
searchLinkSeparator : '|', 	// String: separator of the values passed to the search engine; => ?region=value1|value2|value3
clicksLimit : 0,			// Integer: limited number of clicks; 0 - unlimited clicks;
clicksLimitAlert : 'You can select only %d region! || regions!',
							 // String: error message when the clicks limit has been reached;
							 // syntax: [beginning of sentences] %d [singular] || [plural] - where %d is a number of clicks (added by script);

// List of addresses
agentsListId : '',			// Selector: ID of the list of agents/addresses; must start with a hash (#) mark;
agentsListOnHover : false,	// Boolean: show and hide agent/address on hover;
agentsListSpeed : 0,		// Integer: fade in/fade out delay in miliseconds; 0 - no fade effect;
							// doesn't work when the agentsListOnHover mode is on;

// custom events
'onHover' : function(e){},			// Callback: function(listItem) - invoked when the mouse pointer enters a region and passing a current list item element;
'unHover' : function(e){},			// Callback: function(listItem) - invoked when the mouse pointer leaves a region and passing a current list item element;
'onClick' : function(e){},			// Callback: function(listItem) - invoked when region is clicked and passing a current list item element;
'onSecondClick' : function(e){},	// Callback: function(listItem) - invoked when region is clicked second time and passing a current list item element;
'onLoad' : function(e){}			// Callback: function(mapObject) - invoked when map is fully loaded and passing a mapObject; => $('#map-poland');

Default features

This map is based on well-known CSS sprites. The jQuery is used to simplify the markup and adds additional functionality, as activated region, multipe clicks etc. The map script allows to:

  • - highlight or activate one region and reference to a page in the link,
  • - in the Multiple Click mode allows to select several regions and pass their values to the search engine,
  • - show or hide list of addresses (agents) in selected region,
  • - navigate and activate region using a keyboard,
  • - display simple list of regions when user disable JavaScript.


The map is hand-coded in specific sizes, which can't be changed. The only way to change the size of a map is to rewrite most of the CSS file.

Supported browsers

This map has been successfully tested in:

  • Chrome 1+
  • Firefox 3.6+
  • Internet Explorer 7+
  • Opera 9+
  • Safari 3+
  • mobile Safari (iPhone, iPod Touch, iPad)

Of course there are several limitations caused by lack of the CSS support in older browsers. For example in the IE7 cities layer can't be displayed, also there's a bug with arrows under the tooltips in the IE7 and Firefox below 3.6.

You can force it to work in the IE6 (SP2) by using GIF files instead of transparent PNG.

The CSS - Tips and tricks

The basics

By CSS style sheets you can customize almost any map element. You can edit them in the default map's CSS file (cssmap-poland.css) or in the style sheet of your site. As you can see, there is nothing more than CSS rules you should be familiar with.

Styling 'tooltips'

By default names of the regions are displayed as a 'tooltip' with arrow. You can customize it by style rules for the .css-map li a, #map-tooltip element:

.css-map > li a,.css-map > li a:hover,#map-tooltip,.cssmap-tooltip-content{
  background: #111;
  background: rgba(0,0,0,.8);
  color: #eee;
  font: normal 13px 'Lucida Grande',Arial,sans-serif;
  padding: .5em 1.2em;
  text-align: center;
  text-shadow: 0 1px 0 #000;
  white-space: nowrap;
  -moz-border-radius: .6em;
  -ms-border-radius: .6em;
  -webkit-border-radius: .6em;
  border-radius: .6em;

..arrow of the "sticky" tooltips can by customized by .css-map li a .tooltip-arrow

 /* tooltip arrow; when you change its size don't forget to set tooltipArrowHeight variable in the cssMap(); function */
 .css-map > li a .tooltip-arrow{
  bottom: -5px; /* must be the same as a border-width */
  border: solid;
  border-color: #111 transparent;
  border-color: rgba(0,0,0,.8) transparent;
  border-width: 5px 5px 0 5px; /* this's a height of the arrow */
  margin-left: -5px; /* must be the same as a border-width */
 .css-map > li a.tooltip-right .tooltip-arrow{
   margin-right: -5px; /* must be the same as a tooltip-arrow border-width */
 .css-map > li a.tooltip-top .tooltip-arrow{ /* set tooltip under the arrow */
   border-width:0 5px 5px 5px;
   top: -5px;

Styling visible list of regions

If you enable a visible list of regions you can customize its link by #map-poland .map-visible-list a

#map-poland .map-visible-list a{
  /* default link style */

#map-poland .map-visible-list a:hover,
#map-poland .map-visible-list a:focus,
#map-poland .map-visible-list li.focus a{
  /* selected link (region) */

#map-poland .map-visible-list a:active,
#map-poland .map-visible-list li.active-region a{
  /* active link (region) */


Styling search link (in the Multiple Click mode)

The search link will display under the map in the Multiple Click mode and can by styled by .map-search-link

 /* default link style */

 /* selected link */

.m540 .map-search-link{
 /* style for a specific map size */


Hiding pre-loader

If you want to hide a pre-loader when map is not loaded use these rules (must be set before map's style sheet):

.map-loader{ display: none; }

Hiding region's names before script is loaded

#map-poland li a{
  margin: -9999em 0 0 0;
  position: absolute;

Use responsibly! It must be set before map's style sheet. You'll be unable to see and use links when the map doesn't load!

Maps in the responsive designs

We all love the responsive designs and other goodness brought us by CSS3.
So, how you can modify the CSS to work with @media queries?

In the CSS file you'll find styles for all available map sizes. All you need to do is wrap them in the @media rules and replace all size classes .m123 to the one used in your project.

/* sample usage of the @media queries for the 960px wide map */

@media screen and (min-width: 500px){
  /* size: 540 */
  .m960{width:540px} .m960 .poland,.m960 .poland .bg,.m960 .poland-cities{background:transparent url('pl-540.png') no-repeat -1230px 0} /* etc. */
  .m960 .pl1.focus .bg,.m960 .pl1.active-region .bg{height:47px;left:232px;top:68px;width:27px} .m960 .pl1 /* etc. */
  .m960 .pl1 a{left:253px;top:101px} .m960 .pl2 a{left:112px;top:205px} .m960 .pl3 a{ /* etc. */

@media screen and (min-width: 750px){
  /* size: 750 */
  .m960{width:750px} .m960 .poland,.m960 .poland .bg,.m960 .poland-cities{background:transparent url('pl-750.png') no-repeat -890px 0} /* etc. */
  .m960 .pl1.focus .bg,.m960 .pl1.active-region .bg{height:70px;left:353px;top:107px;width:40px}.m960 .pl1 /* etc. */
  .m960 .pl1 a{left:380px;top:151px} .m960 .pl2 a{left:168px;top:308px} .m960 .pl3 a{ /* etc. */

@media screen and (min-width: 960px){
  /* size: 960 */
  .m960{width:960px} .m960 .poland,.m960 .poland .bg,.m960 .poland-cities{background:transparent url('pl-960.png') no-repeat -1106px 0} /* etc. */
  .m960 .pl1.focus .bg,.m960 .pl1.active-region .bg{height:93px;left:464px;top:136px;width:53px}.m960 .pl1 /* etc. */
  .m960 .pl1 a{left:497px;top:192px} .m960 .pl2 a{left:214px;top:403px} .m960 .pl3 a{ /* etc. */

Some mobile devices have limited the maximum size of the downloaded image, so in some cases (BlackBerry, first generation iPhone etc), you will see a list of regions instead of the map larger then 750px wide.

You should customize a map image to your needs!

Editing a map file

Best software to edit the .psd source files is the Adobe Photoshop or the Adobe Fireworks ..but you can also use the free online editor: Pixlr!

Layer styles

You can freely edit the layer styles of the map, but:

  1. Do not change position of layers and shapes! - by default position of all layers is locked.
  2. Use a 'Layer Style' tool to change fill color, shadows, line color etc.
  3. Position of the line (stroke) must be set to the center!
  4. The shadow (Drop Shadow) and the outer glow (Outer Glow) of regions can't be wider than 10px (or 5px in the 210px wide maps).
  5. Before you save a map file don't forget to hide the background layer (.bg).
  6. The map file must be saved [Ctrl+Alt+Shift+S] as the PNG-24 Transparent!
  7. Don't remove the 'signature' layer.

Of course you can hide or show layers with lakes and rivers if any.
Also you can use the 'map area' layer to put anything you want on the map and display it instead of the cities labels.

Use pngquant, ImageOptim or any other software to optimize PNG files.

Don't forget to optimize a map file before you send it to the server!

Visible list of regions

To display a visible list of regions just add a visibleList parameter to the cssMap(); function:

  'visibleList' : true

The script duplicate list of regions with all its content and functionality. Second list is placed just under the main list and has .map-visible-list class.

The second list can be easily styled and positioned relative to the map: below, left, right or in columns. Learn more about styling a visible list of regions in 'The CSS - tips and tricks' section.

The Multiple Click mode

Allows to activate several regions, and pass their values to the search engine script by the region variable. To activate the Multiple Click mode just add a multipleClick parameter to the cssMap(); function:

  'multipleClick' : true

In the list of regions use secure URLs, example: search.php?region=region-name instead of #region-name.
That allows passing variables to the search engine for users with disabled JavaScript.

The values are assigned to the search link, according to the scheme: search.php?region=value1|value2|value7

Variables sent to the PHP script can be easily get by the explode() function:


By default you can select all regions, but if you want, you can set a clicks limit:

  'multipleClick' : true,
  'clicksLimit' : 3

Below the map will be shown a link to the search engine, by default: <a href="search.php" class="map-search-link">Search</a>, but it can be customized by several parameters:

  multipleClick : true,		// enable Multiple Click mode;
  searchUrl : 'serach.php',	// URL to the search engine;
  searchLink : 'Szukaj', 	// Name of the search link;
  searchLinkVar : 'region', // Variable passing to the search engine;
  searchLinkSeparator : '|'	// Separator of the values passed to the search engine; => ?region=value1|value2|value3

List of addresses

Probably the main usage of the map should be possibility to show or hiding the list of addresses of the agents (offices) in the regions.

To activate a list of addresses just add a agentsListId parameter to the cssMap(); function:

  agentsListId : '#addresses'

  // optional: fade in/fade out delay in miliseconds;
  agentsListSpeed : 500,
  // optional: show and hide agent/address on hover;
  agentsListOnHover : true,

The value of this parameter must be the ID of the list of agents/addresses and start with the hash (#) mark.

In the list of addresses (shown on the right) id of each list item must be the same as the link in the list of regions. That should works as any internal navigation when JavaScript is disabled.

Create a list of addresses, according to the scheme:

<div id="addresses">
  <li id="dolnoslaskie">
  <!-- Dolnośląskie -->

  <li id="kujawsko-pomorskie">
  <!-- Kujawsko-pomorskie -->

  <li id="malopolskie">
  <!-- Małopolskie -->



Error: map size must be set!

Check size parameter in the cssMap(); function:

/* availalbe sizes:
 * 170, 240, 270, 340, 500, 660 and 810; 
$('#map-poland').cssMap({size: 810});

Not working! The map doesn't appear!

  1. Make sure you've uploaded the cssmap-poland folder on your server.
  2. Your page can't be in the quirks mode - the !doctype must be set!
  3. Check path to the CSS file.
  4. Check path to the folder with maps.
  5. Check names of the PNG map files.
  6. Once again check that the PNG files are in the same folder as the CSS file ( cssmap-poland.css )

Before you write for a help

If you're using another JS library, like a MooTools or Prototype make sure there is no conflict between them. For more information, see the jQuery documentation: Using jQuery with other libraries.

Always use a recent version of jQuery!

Check if there are no errors in other scripts and make sure your code is written correctly. Errors in the scripts can be found in 'Error Console' in your browser or by the add-ons like Firebug for Firefox. Also use the W3C Validator to check your code.

Royality Free License

Map is distributed under royality free license and can be used (also croped, modified or manipulated) in all kinds of web creations as websites, templates and themes (personal, commercial or client projects) without any extra fees.
Don't sub-license, resell, transfer or share this map in downloadable format. Read full license agreement


If you have any questions regarding setup, licensing, payments, or would like to order custom map of any regions, feel free to contact me at or Tweet @CSSMapplugin

I'm very patient, but remember: I'm not here to learn you basics of the HTML or Photoshop. If you're using any content management system (Joomla, Drupal, WordPress etc.) learn its documentation first!