开发者

javascript, jquery and jquery-ui gotchas when placing at bottom of page [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

As per the yahoo performance recommendations I tried moving my external js files to t开发者_如何转开发he bottom of my page.

as a result some bits of javascript are broken/not working.

im not sure exactly what or why things arent working so I'd like to know for javascript in general and sepecifically for jquery and jqueryui of gotchas to be wary of.


This is probably because you're using jQuery/jQueryUI code - namely .ready() - further up in the document.

Consider putting jQuery back into the head. jQueryUI may work in the bottom if all code calling it is wrapped in a ready event.

If you link to jQuery on a CDN, chances are the browser has the file loaded anyway already, and there will be no performance hit from having it in the head.


If you have any inline code in the page that will of course break, even if it's wrapped in $().ready() or similar, since jquery isn't loaded yet. Also, make sure that you're loading them in correct order, so jquery first and then jqueryui etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜