javascript - Centering with ImageMapster -
javascript - Centering with ImageMapster -
i have image uses imagemapster wrapped in div, div won't center reason. if remove js code, div centers, it's due image mapster stuff.
it's quite simple, just:
<div class="chartmap"> <img id="waterfall" align="middle" src="http://i1372.photobucket.com/albums/ag358/rls462/waterfall_zpsdd7cc432.png" usemap="#water" alt="waterfall methodology map"> <map name="water"> <area ......> ... </map> </div>
here's demo: http://jsfiddle.net/stamblerre/t6k8x/13/
any thoughts? thanks!!!!
when initializing mapster on img element, jquery wraps image dynamic container thats aligned left default. want re-align dynamic container center:
$('#waterfall')
image, access wrapping container need phone call $('#waterfall').parent()
, align it: .css({"margin":"0 auto"})
js:
$(document).ready(function () { $('#waterfall').mapster({ singleselect: true, clicknavigate: true, scalemap: false, fill: false, stroke: true, strokecolor: '000080', strokewidth: 3, mapkey: 'data-name', }).parent().css({"margin":"0 auto"}); });
here fixed fiddle
javascript jquery html css
Comments
Post a Comment