Parent container not overflowing if child scald using css3 Transform:Scale -
i working on css3 transform.
parentdiv{ overflow:scroll; } img{ width:100%; height:auto; } i have image inside div. parentdiv scroll in y-direction per image height. when transform img css3 scale, img width increases , parent div not scrolling in x-direction. jsfiddle link:: https://jsfiddle.net/yf48ga22/
see instead of scaling image, scale div in image present see scroll on both axis i.e x , y. have made few changes html structure understanding check jsfiddle.
$(document).ready(function(){ $("#box > .ch").css({ 'transform' : 'scale(1.8)', 'transition' : '1s ease' }); }); #box{ overflow-x: auto; overflow-y: auto; display: flex; background:red; flex-direction: column; } #box > .ch{ flex:1; flex-shrink: 0; background: #fff; overflow: auto; } #box > .ch > img{ width:100%; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="box"> <div class="ch"> <img src = "https://s3-us-west-2.amazonaws.com/cbsapp/package_content/s78c_e4vt6/main_images/pg_4.jpg"> </div> </div>
Comments
Post a Comment