Open vietvh opened 11 years ago
public static function carousel($selector = 'carousel', $params = array())
{
$sig = md5(serialize(array($selector, $params)));
if (!isset(self::$loaded[__METHOD__][$sig]))
{
// Include Bootstrap framework
self::framework();
// Setup options object
$opt['interval'] = (isset($params['interval']) && ($params['interval'])) ? (int) $params['interval'] : 5000;
$opt['pause'] = (isset($params['pause']) && ($params['pause'])) ? $params['pause'] : 'hover';
$options = self::_getJSObject($opt);
// Attach the carousel to document
JFactory::getDocument()->addScriptDeclaration(
"(function($){
$('.$selector').carousel($options);
})(jQuery);"
);
// Set static array
self::$loaded[__METHOD__][$sig] = true;
}
return;
}
System info
Bug info
The linked patch improves the Bootstrap and jQuery HTML helpers by streamlining the loading of the new JavaScript frameworks, adds most of the Bootstrap plugins into the HTML helper for simplified loading, removes the duplicated tooltip helper, and improves JHtml::includeRelativeFiles() to support loading the non-minified versions of the new JS files in debug mode.
Test instruction
(For demo purpose only, quote from: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=28941)