jquery - How can i place a button always center of the graph -
enter image description herei have 1 start button.how can place start button center of graph when resize window should center of graph.how can it?
js:
$( window ).resize(function() { var chart = $('#container').highcharts(); var textx = chart.plotleft + (chart.plotwidth * 0.5); var texty = chart.plottop + (chart.plotheight * 0.5); $('. placebtn').css('left', textx + (span.width() * -0.5)); $('. placebtn').css('top', texty + (span.height() * -0.5)); }); var chart = $('#container').highcharts(); var textx = chart.plotleft + (chart.plotwidth * 0.5); var texty = chart.plottop + (chart.plotheight * 0.5); $('. placebtn').css('left', textx + (span.width() * -0.5)); $('. placebtn').css('top', texty + (span.height() * -0.5));
jsfiddle:https://jsfiddle.net/7skvx8l5/2/
remove position: absolute
, , add text-align: center
row.
.placebtn { /* position: absolute; */ width:94px; background-color:#ccc !important; border-color: #000 !important; color: #000000; } .col-lg-12 { text-align: center; }
if don't calling text-align every .col-lg-12, can add class row this:
<div class='col-lg-12 center'>
and in stylesheet:
.center { text-align: center; }
or mean this:
Comments
Post a Comment