Forum Academy Marketplace Showcase Pricing Features

Get an exact number of pixels of a specific element on page

How I can get an exact number of pixels of a specific element, I have to implement animation on the page scroll.

Give the element an ID

You could use the plugin toolbox to run some JavaScript and out put a value

You should use the .offsetWidth and .offsetHeight properties. Note they belong to the element, not .style.

var width = document.getElementById('foo').offsetWidth;

Source

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.