0
In my project, I have an image that as the screen goes down 1000px, 860px, 320px, etc the image also changes its height.
How to do to catch the height at the time of display?
I need to know this time to set the margin-top
of a div
that goes below her.
with Jquery some way out?
– Carlos Rocha
@Carlosrocha ... the less jQuery the better. Yes, there is a way with jQuery:
var altura = $('img').height();
– Sergio
That’s the problem. The height is very high when we reduce the resolution. Although the image appears correctly the height information is wrong, See http://hotplateprensas.com.br/new/
– Carlos Rocha
in localhost, is returning 88 with the browser open at most. On the web gives 0px; When I decrease the resolution to 350px then local gives 9723px and on the web gives 0 also.
– Carlos Rocha
how to implement var img = Document.querySelector('img'); with image id?
– Carlos Rocha
tried so Alert($("#logo").innerheight());, gave the same thing
– Carlos Rocha
I did so highLogo = $("#logo"). innerheight(); Alert(highLogo); $(".top"). css("height", highLogo+" !Mportant"); The inspector says the height is 110,531, already in Jquery says it is 147
– Carlos Rocha
@Carlosrocha jQuery uses the
getBoundingClientRect
. For me it shows the same in inpetor and console. Which browser are you using?– Sergio
I’m using google chome
– Carlos Rocha
@Carlosrocha can make a jsFiddle that reproduces the problem?
– Sergio
I can send you the link where the problem is: http://hotplateprensas.com.br/novo/. Pos is a lot to put there and know how to filter out what they are for
– Carlos Rocha