Tag: dimensions

Calculate the dimensions of an image by its filesize

Using javascript is there any method to calculate the dimensions of an image just from knowing its filesize? I am assuming that differen’t formats (JPEG/PNG) require a different calculation but I am only looking to use JPEG or PNG.

jQuery: how to get the dimensions of a external image?

Looking for a way to get the dimensions (width and height) of an external image. I have used prop() and attr(), but they don’t return any values. Just an error. Example: <a href=”pathtotheimage”>some link</a>

Javascript – Get the width of an undefined element

I have a div element, that has no defined width or height. It holds other elements, and molds on their size. I need to get the final size of the div, without being able to check the sizes of the elements inside of it (dynamic elements). I tried parsing all the properties of the object, […]

jQuery set custom dimensions for an element

I have a div which I would like to set custom dimensions using two text inputs. <div id=”theFrame”></div> width: <input id=”custWidth” type=”text”> height: <input id=”custHeight” type=”text”> <br> <button id=”custSet”>Set my width!</button> I have tried setting the height and width with variables, but I am at a loss as to how to do it now. var […]

Javascript – Crossfilter – Fetch data from server and find unique users

I am a newbie to JS. I know that this question has been asked before – find unique users. What I am unable to get to work is the case when data is being fetched from server. I get a blank screen whenever I try to import data from the server. Here’s the .js file […]

Resizing Page Elements based on Window size

Problem: My Client wants me to create a launch webpage for his product such that there should be no scroll on the page, be any browser or window dimensions. Doubt: Is this possible using CSS and Javascript? Some Early Diagnosis: This might be a little similar to this or this but the difference is that […]

Shouldn't window.screen.width/height correspond to actual screen width/height?

Toying around with the WebKit browser in the new Kindle 3G, I noticed that window.screen.width and window.screen.height don’t reflect the actual screen dimensions. The physical screen (or rather, paper) dimensions are 800 x 600. I get: 800 x 506 in landscape mode 600 x 706 in portrait mode But interestingly, both Chrome and Safari (which […]

Can I use Jquery to find an element and set it's CSS width to current-width – x?

Say I need to correct a number of elements widths by 19px. Is it possible to find elements and set the found elements CSS-width like so: $el.find( ‘.ui-content’ ) .css({‘width’: “parseFloat(found_element_current_width) -19” }) If not, what’s the best way to do this?

Confused by document dimensions in JavaScript

I am really confused by the different properties that exist in JavaScript for getting the dimensions of a document and how to get those numbers. Can someone recommend a good place to start to understand how I would get the size of the document and position stuff correctly?

Are an element's dimensions readable immediately upon adding it to the DOM tree?

Suppose I dynamically create a DIV using document.createElement, add some inner text, and want to determine its height and width. I can see that before adding the DIV to the DOM tree, properties such as offsetWidth and offsetHeight are 0, which is expected. Once it is programmatically added to the tree, can I expect those […]