當前位置: 首頁>>代碼示例>>PHP>>正文


PHP JHtmlBootstrap::getJSObject方法代碼示例

本文整理匯總了PHP中JHtmlBootstrap::getJSObject方法的典型用法代碼示例。如果您正苦於以下問題:PHP JHtmlBootstrap::getJSObject方法的具體用法?PHP JHtmlBootstrap::getJSObject怎麽用?PHP JHtmlBootstrap::getJSObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在JHtmlBootstrap的用法示例。


在下文中一共展示了JHtmlBootstrap::getJSObject方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: startAccordion

 /**
  * Add javascript support for Bootstrap accordians and insert the accordian
  *
  * @param   string  $selector  The ID selector for the tooltip.
  * @param   array   $params    An array of options for the tooltip.
  *                             Options for the tooltip can be:
  *                             - parent  selector  If selector then all collapsible elements under the specified parent will be closed when this
  *                                                 collapsible item is shown. (similar to traditional accordion behavior)
  *                             - toggle  boolean   Toggles the collapsible element on invocation
  *                             - active  string    Sets the active slide during load
  *
  * @return  string  HTML for the accordian
  *
  * @since   3.0
  */
 public static function startAccordion($selector = 'myAccordian', $params = array())
 {
     $sig = md5(serialize(array($selector, $params)));
     if (!isset(static::$loaded[__METHOD__][$sig])) {
         // Include Bootstrap framework
         static::framework();
         // Setup options object
         $opt['parent'] = isset($params['parent']) ? (bool) $params['parent'] : false;
         $opt['toggle'] = isset($params['toggle']) ? (bool) $params['toggle'] : true;
         $opt['active'] = isset($params['active']) ? (string) $params['active'] : '';
         $options = JHtmlBootstrap::getJSObject($opt);
         // Attach accordion to document
         JFactory::getDocument()->addScriptDeclaration("(function(\$){\n                    \$('#{$selector}').collapse({$options});\n                })(jQuery);");
         // Set static array
         static::$loaded[__METHOD__][$sig] = true;
         static::$loaded[__METHOD__]['active'] = $opt['active'];
     }
     return '<div id="' . $selector . '" class="accordion">';
 }
開發者ID:rodhoff,項目名稱:MNW,代碼行數:34,代碼來源:bootstrap.php


注:本文中的JHtmlBootstrap::getJSObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。