css - div style cursor pointer is not working in chrome -
i have added custom controller google map api. 1 div in custom controller should clickable. have added cursor:pointer
style. works in firefox not in chrome. in chrome browser, displays hand icon click action not working.
this code added html file add html custom controller.
controltext.innerhtml = '<div id="newid" class="myclass" style="width:380px; margin-left:40px; margin-bottom:20px;">click here proceed</div></div>';
i have added click event listner following.
map.controls[google.maps.controlposition.bottom_left].clear(); map.controls[google.maps.controlposition.bottom_right].clear(); var inputfieldcontroldiv = document.createelement('div'); var inputfieldcontrol = new textfieldcontrol(inputfieldcontroldiv, map); map.controls[google.maps.controlposition.bottom_left].push(inputfieldcontroldiv);
css file
.myclass{ cursor:pointer; }
tested in mozzila, opera, ie11, chrome , works (it shows cursors specified in class)
here fiddle: https://jsfiddle.net/eugensunic/kphe5fbl/10/
i've included following code of yours: controltext.innerhtml = '<div id="newid" class="myclass" style="width:380px; margin-left:40px; margin-bottom:20px;">click here proceed</div></div>';
, clearing altought believe not necessary.
here full code js in fiddle:
var map; var london = new google.maps.latlng(51.508742, -0.120850); function textfieldcontrol(controldiv, map) { var controlui = document.createelement('div'); controldiv.appendchild(controlui); var controltext = document.createelement('div'); controltext.innerhtml = '<div id="newid" class="myclass" onclick="alert()"style="width:380px; margin-left:40px; margin-bottom:20px;">click here proceed</div></div>'; controlui.appendchild(controltext); } function initialize() { var mapdiv = document.getelementbyid('googlemap'); var myoptions = { zoom: 12, center: london, maptypeid: google.maps.maptypeid.roadmap } map = new google.maps.map(mapdiv, myoptions); var homecontroldiv = document.createelement('div'); var homecontrol = new textfieldcontrol(homecontroldiv, map); map.controls[google.maps.controlposition.bottom_left].clear(); map.controls[google.maps.controlposition.bottom_right].clear(); map.controls[google.maps.controlposition.bottom_left].push(homecontroldiv); } google.maps.event.adddomlistener(window, 'load', initialize);
of-course, cursor switch value "default" @ point because of margins css set pixels.
edit
the other issue make obstruction here have developer tools tab open, has been solved in stackoverflow thread:
if still have problems shoul reveal testfieldcontrol function.
Comments
Post a Comment