javascript - get the style of the marker I clicked on in mapbox -
i'm trying style of icon clicked on, in order translate values. i'm doing because want create div have same location on map icon got clicked on. website far: http://www.david-halfon.com/radio/index.html
basically, each time presses yellow circle, div should appear around it.
this code events happen when icon being clicked:
locale.on('click', function(e) { $("#music").attr("src", prop.url); $(".player").show(); play(); sendwithajax(prop.country, prop.city); $("h1").html(prop.station); $("h2").html(prop.country); $("h3").html(prop.city); //console.log($(this).css("transform")); //console.log($(this).attr("style")); console.log($(this)); settimeout(function(){ $("h4").html(globalvar);}, 500); $(".plusb").show(); $(".shareb").show(); map1.setview(locale.getlatlng(), 4); playnow = prop.station; playnowcountry = prop.country playnowcity = prop.city; });
the comments have tried far does'nt seems work.
when i'm trying consloe.log(this) 'undefined'.
thank you!!
the reason why don't expected $(this).css(...)
informations this
not regular dom object, appears using firebug:
the <img>
want style contained in _icon
member of object, can use e.g.:
console.log($(this._icon).css('transform')); console.log($(this._icon).attr('style')); // , on
this way (tested using firebug on website), works fine.
btw, couldn't figure out why click event targets object rather <img>
...
btw again, website great idea: cool!
Comments
Post a Comment