addLoadEvent

OK, so I had a problem with this theme disabling the javascript functions within Drupal, specifically the collapsible fieldsets in the administration>settings page. This, after much hair-pulling was due to the rather dumb fact that I was using a window.onlad call in my custom javascript that powers the theme. After Searching drupal.org extensively, I finally found this which pretty much sums it up. Simply change any window.onload calls to:

if (isJsEnabled()) {
addLoadEvent(yourCustomJSFunction);
}

I have now excountered the situation where I somehow disabled the drupal javascript inclusion in the head of my document. I fixed it by adding a call to drupal_add_js() in my template.php (where I should be calling my JS from anyways I have also learned :)).

Comments

Post new comment

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <br> <p> <pre> <b> <del>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You may post PHP code. You should include <?php ?> tags.
  • You may link to Gallery2 items on this site using a special syntax.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.