开发者

JQuery-code on different content pages

开发者 https://www.devze.com 2022-12-08 22:09 出处:网络
I have a site with menu, which reloads content. Content is dynamically loadable, using ajax and php-script. At different content pages I need in different jquery-plugins. But If I\'m writing including

I have a site with menu, which reloads content. Content is dynamically loadable, using ajax and php-script. At different content pages I need in different jquery-plugins. But If I'm writing including need plugin directly in some content page, I get a big lags during loading. So, now I'm includgin all plugins into main page... And it's not the best idea... Any suggestion?


UPD: I have a div with content. Content is shown with effects (rolling up/down). When part开发者_Python百科 of menu is clicked, I'm sending ajax-responce to the php script, which reads need text from database and returns it to the main page, from which I sent the responce. Than I'm pasting that content into a div and roll id down.

So I'll include jquery-plugins in content pages, the animation of rolling will'nt be normal.


Including all plug-ins in a single JS file in the main page will minimize your HTTP requests, so it is the best idea from an overall performance standpoint.

On the other hand, loading plug-ins only when they are needed would improve your initial page load. It sounds like you are doing something similar, though. Can you provide more details on how you're loading the script?

0

精彩评论

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