Greetings. I have this jquery that assigns the height to a div in relation to a child image
$(window).load(function(){
var alto = $('#bigPic img').height(); //alto de la imagen
$('#bigPic').height(alto * 1.1); }); //alto div = alto imagen * 1.1
And this one that changes the height of the div in relation to the same image only when the window size changes (not when loading the page)
$(window).resize(function () {
$('#bigPic').height($('#bigPic img').height() * 1.1);});
$(window).trigger('resize');
How would you make the two functions merge or that the resize also work when loading the page? Thank you very much.
Create a function:
Then you call it wherever you need it:
So the resize function works for you in both events, which is what you ask.
Cheers,