I've this code:
<script> $(document).ready(function larg(){ var larghezza = $(document).width(); $("p.width").text("The width for the " + larghezza + " is px."); }); $(window).resize(function() { larg(); }); </script>
I would like to call the function "larg" on window resize, but it doesn't work.. How to do that??
Thanks
You can't declare functions that way, use it like this.
<script> $(document).ready(larg); $(window).resize(larg); function larg(){ var larghezza = $(document).width(); $("p.width").text("The width for the " + larghezza + " is px."); } </script>
EDIT: changed code a bit, thanks commenters
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With