javascript - Page shifts to right when a hidden div is displayed -
i using css3, html5 , javascript build page. there div hidden @ start , visible when user selets check box. happenning when select check box whole page shifts right , on deselecting checkbox returns normal position (shifts left). encountering on both chrome , ie. not sure whats causing margin, border , padding appears same when selecting checkbox. when open developer's console pressing f12, shifting not happen. ocurs when page maximized. code is:
javascript
$('#ispropertyhandedover').change(function () { if ($(this).prop('checked')) { $('#handoveryesdiv').prop('hidden', false); } else { $('#handoveryesdiv').prop('hidden', true); } });
css
textarea.form-control{ height: 20em; } input[readonly] { cursor: default !important; } textarea[readonly]{ cursor:default !important; } #addednote{ height: 10em !important; resize: none; } .field-validation-error{ color:red } fieldset.scheduler-border { border: 1px groove #ddd !important; padding: 1.4em 1.4em 1.4em 1.4em !important; margin: 0 0 1.5em 0 !important; -webkit-box-shadow: 0px 0px 0px 0px #000; box-shadow: 0px 0px 0px 0px #000; } legend.scheduler-border { font-size: 1.2em !important; font-weight: bold !important; text-align: left !important; width:auto; padding:0 10px; border-bottom:none; } .panel-inside-form .panel-body{ background-color:#eeeeee; } .panel-inside-form input[type="text"]{ /*border-color:black;*/ margin-bottom:1em; border-color:rgb(169,169,169); } .panel-inside-form textarea{ /*border-color:black;*/ margin-bottom:1em; border-color:rgb(169,169,169); } .panel-inside-form select{ /*border-color:black;*/ margin-bottom:1em; border-color:rgb(169,169,169); } .panel-inside-form input[type="checkbox"]{ /*border-color:black;*/ margin-bottom:1em; } select.input-validation-error{ border-color:lightcoral } input[type="text"].input-validation-error{ border-color:lightcoral } textarea.input-validation-error{ border-color:lightcoral } .form-group.required .control-label:after { content:" *"; color:red; }
html
<div id="handoveryesdiv" hidden> <div class="form-group form-group-check"> <div class="col-sm-4"> @html.labelfor(m => m.iskeyshandedover, new { @class = "control-label" }) </div> <div class="col-sm-8"> @html.checkboxfor(m => m.iskeyshandedover) @html.hiddenfor(m => m.eventid) @html.hiddenfor(m => m.ishandovercompleted) </div> </div> <div class="form-group form-group-check"> <div class="col-sm-4"> @html.labelfor(m => m.issafetycertificateshandevover, new { @class = "control-label" }) </div> <div class="col-sm-8"> @html.checkboxfor(m => m.issafetycertificateshandevover) </div> </div> <div class="form-group form-group-check"> <div class="col-sm-4"> @html.labelfor(m => m.isinstructionsormanualshandedover, new { @class = "control-label" }) </div> <div class="col-sm-8"> @html.checkboxfor(m => m.isinstructionsormanualshandedover) </div> </div> <div class="form-group form-group-check"> <div class="col-sm-4"> @html.labelfor(m => m.islegionellacheckperformed, new { @class = "control-label" }) </div> <div class="col-sm-8"> @html.checkboxfor(m => m.islegionellacheckperformed) </div> </div> <div class="form-group"> <div class="col-sm-4"> </div> <div class="col-sm-8"> @html.validationmessagefor(m => m.islegionellacheckperformed) </div> </div> </div>
i think issue connected positioning through css. inserting position: relative
in css related element contains handoveryesdiv
, while 1 should written absolute
?
Comments
Post a Comment