Syndicate content

My JavaScript code does not get the correct widget size, why?

As I am developing a set of pages for a customer, I ran in an intersting problem: my JavaScript function could not properly define the sizes of a box.

That box is heavily tweaked with the CSS assigned to it, as well as all of its neighbors. So I thought that may have something to do with it.

What I hadn't realized so far is that the ready() function of jQuery() is called once the script that includes it is ready (as in loaded) and not once the document as a whole is ready (done loading, i.e. onload event.)

With that knowledge it was easy to understand that I was actually finding myself with the CSS file in the wrong location, namely, after the JavaScript that was attempting to position a division at the right place and instead was moving it in a completely wrong location because at the point of execution all the page dimensions were still wrong.

So... to do things properly, you want to create a <head> tag with:

1. All your meta data (description, images, etc.)

2. All your CSS links and <style> tags

3. All your JavaScripts

That way you are much less likely to run into problems.

Syndicate content

Diverse Realty

Diverse Realty Team

Want a New Home?
Want to Sell Your House?

Call Alex at
+1 (916)
220 6482

Alexis Wilke, Realtor
Salesperson
Lic. # 02024063

Cory Marcus, Broker
Lic. # 01079165

     

Terms of Site Index

Find the page/content you are looking for with our index.

  • Bill Armend
    Author of Fox Trot comic strips and books. His website
  • Qt

    Qt is a multi-platform development system for servers, command line tools, and graphical applications (GUI). It allows you to create objects that will work on many operating systems with very minimal if any changes.

  • device

    In Information Technology a device is generally a physical item that can be controlled by the computer. The hard drive, a USB camera, a memory chip, etc. are all devices.

  • firewall
  • please