Title: Track clickable
Last modified: June 28, 2017

---

# Track clickable

 *  Resolved [hgud123](https://wordpress.org/support/users/hgud123/)
 * (@hgud123)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/track-clickable/)
 * Hi. When I have a map with my tracks, it seems that the tracks are clickable –
   but nothing happens. I would like to link each track to its own page. Is that
   possible?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [tinuzz](https://wordpress.org/support/users/tinuzz/)
 * (@tinuzz)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/track-clickable/#post-9272433)
 * Hi,
 * Yes, it is possible, but you have to code it yourself in JavaScript.
 * After the map and the track have been initialized, you can get to the track object
   via the global Trackserver object:
 * `Trackserver.mydata.<div_id>[<track_id>].track`
 * So, for example on a page with one map that has track id 99 on it, the track 
   object would be:
 * `Trackserver.mydata.tsmap_1[99].track`
 * Once you have this object, you can do stuff with it. See the Leaflet manual for
   more information, for example:
 * [http://leafletjs.com/reference-1.0.0.html#evented](http://leafletjs.com/reference-1.0.0.html#evented)
 * You can add an ‘onClick’ handler like this:
 * `Trackserver.mydata.tsmap_1[99].track.on('click', function() { alert("hallo");});`
 * I hope this helps.
 * Cheers,
    Martijn.
 *  Thread Starter [hgud123](https://wordpress.org/support/users/hgud123/)
 * (@hgud123)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/track-clickable/#post-9276003)
 * Yes, very helpfull. Thank you.
 *  Plugin Author [tinuzz](https://wordpress.org/support/users/tinuzz/)
 * (@tinuzz)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/track-clickable/#post-9276168)
 * Great, glad I could help!
 * Martijn.
 *  Thread Starter [hgud123](https://wordpress.org/support/users/hgud123/)
 * (@hgud123)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/track-clickable/#post-9278413)
 * Hi Martijn
 * Once again thank you for your response. I was a bit quick ending our conversation.
   I haven’t got any experience with javascript. I falsly thought that I could use
   the “object” and the “onClick handler” directly on my page. Not so.
 * I have tried installing a plugin allowing me to write code on specific pages –
   the plugin is not working. (Scripts n Styles).
 * I don’t want to take your time – if possible – can you give me a link to a plugin
   or the code needed to get your brilliant map to be clickable.
 * If I can clikc on a track at get it to open a new page or a popup – it would 
   be so great.
 * Best wishes
    Henrik
 *  Plugin Author [tinuzz](https://wordpress.org/support/users/tinuzz/)
 * (@tinuzz)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/track-clickable/#post-9308450)
 * Hi Henrik,
 * I’m not sure what to tell you. I have been using ‘Per Post Scripts & Styles’ (
   [https://wordpress.org/plugins/per-post-scripts-and-styles/](https://wordpress.org/plugins/per-post-scripts-and-styles/))
   for this, but I see now that it hasn’t been updated in 5 years. It does however
   work with the latest WP.
 * An alternative option, which is a bit more complicated, it to create a special
   plugin or a child theme for this, so you can just write your JS in a dedicated
   file.
 * I’m sorry I can’t really help you any further than this. If you have questions
   regarding Trackserver directly, please let me know.
 * Best regards,
    Martijn.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Track clickable’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/trackserver.svg)
 * [Trackserver](https://wordpress.org/plugins/trackserver/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/trackserver/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/trackserver/)
 * [Active Topics](https://wordpress.org/support/plugin/trackserver/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/trackserver/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/trackserver/reviews/)

## Tags

 * [link](https://wordpress.org/support/topic-tag/link/)

 * 5 replies
 * 2 participants
 * Last reply from: [tinuzz](https://wordpress.org/support/users/tinuzz/)
 * Last activity: [8 years, 10 months ago](https://wordpress.org/support/topic/track-clickable/#post-9308450)
 * Status: resolved