Old version of bootstrap loaded by Joomla

断了今生、忘了曾经 提交于 2019-12-22 17:53:20

问题


I am developing a new web site, for which I installed the latest version of Joomla, 3.1.1. I created a template from scratch, using the Twitter Bootstrap. I downloaded the latest version of Bootstrap, and loaded the related javascript in the index.php of my template.

While creating a carousel on one of my pages, I encountered a bug with the carousel indicators that were not reflecting the current picture. By investigating with Firebug, I realised that the bootstrap.min.js that was loaded on the page was not the one that I placed in /template/xxx/js, but another one in /media/jui/js, loaded by Joomla itself. And the one loaded by Joomla was an older version.

So I copied the latest version of bootstrap.min.js to /media/jui/js, and my carousel is now working perfectly. But (there is always a but), I now have some menus that don't work on the admin side of the site, using the default Isis template. If I put back the older version of bootstrap.min.js, they work again...

I would like to do one of these 2 things:

  • find a way to have Joomla load a different version of bootstrap.min.js for the admin side and the user side of the site
  • find a way to override the javascript loaded by Joomla from my template index.php

Any idea on how to achieve one or the other?

Thanks, Patrick


回答1:


Joomla ships with a slightly modified version of Bootstrap, so you cannot exchange it with a newer version.

The best thing for you to do is to find a version of that carousel script for the Bootstrap version shipped with Joomla. Otherwise you'll get problems on any update.




回答2:


You can override the media by placing a file at templates/<your_template>/js/jui/bootstrap.min.js. But as warned by nibra, there are some modifications in the JS that you'll need to apply in your environment to keep things working. As well, you'd then be using a version of the JS that isn't intended for what we're shipping in the core currently.

So, it's possible to cleanly do it, but there's a fair amount of risk involved.




回答3:


I found a solution that seems to be acceptable: I inserted a <script src=" line in the index.php of my template, to load the latest version of the bootstrap template. As a result, both versions of the bootstrap javascript are loaded, but the most recently loaded is used, and my carousel is working.

I don't expect this to create problems with other modules in Joomla, as I use only basic ones or new modules that I created myself. In any case, the menu module of Joomla was not compatible with bootstrap navbar, and I had to add a few jQuery lines to add the needed classes.

Rgds, Patrick




回答4:


remove JHtml::_('bootstrap.framework'); from your index.php of your template and add any version of bootstrap you want manually, no big deal....except you prolly have to change your entire template markup...



来源:https://stackoverflow.com/questions/16488668/old-version-of-bootstrap-loaded-by-joomla

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!