javascript - How to write this in a more sophisticated way? -
This works, but I'm sure it's written more clearly.
& lt; Script & gt; $ (Document) .ready (function () {$ ('. Col'). CSS ({'height': ($ (document) .height ()) + 'px'}); $ (window) .resize ( Function () {$ ('colonel'). Css ({'height': ($ (document). ()) + 'Px'});})}} gt; I have tried without the first $ ('.cale)' CSS ... and it does not work. So basically what I say to the browser "When the document is ready, resize this div, and resize it at every height change."
this Here is:
& lt; script & gt; $ (window). Resize (function () {$ ('. Col'). CSS ({'height': ($ (document) ). You can listen to the resize event and when the document is ready (); & lt; / script & gt; If it is done, then it can trigger. Other small changes:
- You can enter
document.ready with $ (function () {}) - Resizing event listener can be made before
document.ready , because the window is always the object Is present and you want it Ni quickly requirements can engage.
Comments
Post a Comment