Receiving the wrong header time

Asked

Viewed 38 times

0

I’m trying to get the height of .ui-header so I can have my own dynamic program. Turns out the height you’re giving me is incorrect.

The code to catch the height of .ui-header:

//Altura do header
        var lv_headerHeight =  $(".ui-header").outerHeight();
        alert("HEADER " + lv_headerHeight);

That one alert is returning:

inserir a descrição da imagem aqui

but using Chrome dev tools, indicates that the height of the .ui-header is: inserir a descrição da imagem aqui

How do I get this last amount? Thank you for your attention

I mean, I have this header: inserir a descrição da imagem aqui

Alert is giving me an incorrect height value while Chrome dev tools gives me the correct value. But I’m not getting it

  • I think more information is needed, is there any animation going on in the element? the result is compatible with the height of the elemnet at the time the Alert is called? in a simple example, it works as expected http://jsfiddle.net/4o17h3xe/

  • There is no animation. I thought I’d try to pass the problem to the fiddle, but I’m using jquery-ui and I guess the fiddle doesn’t have that.

  • nor a slidedown? I say this because by print the class of the element quotes a slide down that could be happening. Edit, I’ve just seen your updated comment, an example of fiddle using ui http://jsfiddle.net/xBB5x/2511/

  • I believe that this slidedown is imposed by the UI or something like that, because I’ve just been going through the code and I don’t have any of that

1 answer

0

Try this, you will get the X/Y coordinates from the left/top point:

img = document.getElementById('box');
imagemTopRightX = img.offsetLeft;
imagemTopRightY = img.offsetTop;
alert(imagemTopRightX);
alert(imagemTopRightY);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.