3

I am trying to get offset top value of an element while window is resizing.

I have written this function:

function setPosTop() {
    var offtop = document.getElementsByClassName('cycloneslider-caption')[0].offsetTop;
    console.log('offtop ', offtop);
}

Its working fine on window load, but its not getting the correct value on window resize function.

I have searched and applied many options but not working correctly.

Please provide me solution / magic code regarding this issue. Thanks

4
  • 2
    Impossible to answer like this, can you provide a fiddle / working code example? What do you mean by 'not correctly'? Commented Jan 12, 2017 at 13:14
  • can you show your event window resize handler? Commented Jan 12, 2017 at 13:14
  • do you have something like this? $( window ).resize(function() {setPosTop();}); Commented Jan 12, 2017 at 13:15
  • stackoverflow.com/questions/9828831/jquery-on-window-resize Commented Jan 12, 2017 at 13:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.