Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to add document ready to a javascript code?

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #42446
    AlirezaM
    Participant

    Hello!

    I have this javascript code which I achieved by helping of professionals on css-tricks:

    http://codepen.io/JoshBlackwood/pen/cqDib

    It’s working very well but I should put it’s script after my html codes and I want to put it’s code inside head tags and when I call it, it works.

    I think I should use (document) .ready but I don’t know how.

    Please help!

    thank you in advance!

    Alireza.M

    #123227
    jeffPowers
    Member

    If you’re using standard js you can use body onload but I’d recommend putting it at the bottom of the page so it doesn’t slow page load.

    Hope this helps!

    Cheers,
    Jeff

    #123230
    AlirezaM
    Participant

    Thank you!

    But my pages flow is putting js scripts inside head and call them with a custom js file.

    I really apperciate you If you could help me to doing what I want.

    #123254
    amyth91
    Participant

    just go…

    #123261
    AlirezaM
    Participant

    That’s it.

    Now, it’s working as I wanted.

    Thanks amyth91 and Htmlmainiac !!!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.