Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

mikeill on "Check if Twitter Bootstrap is already loaded"

$
0
0

Developing a plugin that uses Twitter's Bootstrap Modals, but would like to prevent loading bootstrap if it's already loaded.

Apparently the following .js code could do the trick:

<script> if(typeof($.fn.modal) === 'undefined') {document.write('<script src="//www.mysite.com/js/v/bootstrap-2.1.1.js"><\/script>')}</script>

But is there any way of doing it with php, or otherwise preventing the plugin from encoding the script if it's already present?


Viewing all articles
Browse latest Browse all 8245

Trending Articles