javascript - Js:Calling a function on click -
javascript - Js:Calling a function on click -
i utilize maplace.js, google maps javascript plugin jquery. in plugin has function display marker on map.
//triggers show location in map maplace.prototype.viewonmap = function (index) { //view if (index === this.view_all_key) { this.o.beforeviewall(); this.current_index = index; if (this.o.locations.length > 0 && this.o.generate_controls && this.current_control && this.current_control.activatecurrent) { this.current_control.activatecurrent.apply(this, [index]); } this.omap.fitbounds(this.obounds); this.closeinfowindow(); this.o.afterviewall(); //specific location } else { index = parseint(index, 10); if (typeof (index - 0) === 'number' && index > 0 && index <= this.ln) { seek { google.maps.event.trigger(this.markers[index - 1], 'click'); } grab (err) { this.debug('viewonmap::trigger', err.stack); } } } homecoming this; };
i seek phone call method no avail:
<a href="javascript:maplace.prototype.viewonmap(2)">link</a>
how can phone call link key?
you can this:
<a class="openmap" href="#">link</a>
and js:
$('.openmap').on('click', function(e){ e.prevetdefault(); maplace.prototype.viewonmap = function (index) { //view if (index === this.view_all_key) { this.o.beforeviewall(); this.current_index = index; if (this.o.locations.length > 0 && this.o.generate_controls && this.current_control && this.current_control.activatecurrent) { this.current_control.activatecurrent.apply(this, [index]); } this.omap.fitbounds(this.obounds); this.closeinfowindow(); this.o.afterviewall(); //specific location } else { index = parseint(index, 10); if (typeof (index - 0) === 'number' && index > 0 && index <= this.ln) { seek { google.maps.event.trigger(this.markers[index - 1], 'click'); } grab (err) { this.debug('viewonmap::trigger', err.stack); } } } homecoming this; }; });
javascript jquery google-maps jquery-plugins
Comments
Post a Comment