Twitter bootstrap 3 tooltip does not work in Yii framework -
Twitter bootstrap 3 tooltip does not work in Yii framework -
i'm trying utilize twitter bootstrap tooltip in yii app, seems not work. firebug console homecoming error typeerror: $(...).tooltip not function
. can see in code, bootstrap.js file included. function can not found, maybe overriding it? default layout main.php
code:
<head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="language" content="en" /> <!-- design css framework --> <link rel="stylesheet" type="text/css" href="<?php echo yii::app()->request->baseurl; ?>/css/screen.css" media="screen, projection" /> <link rel="stylesheet" type="text/css" href="<?php echo yii::app()->request->baseurl; ?>/css/print.css" media="print" /> <!--[if lt ie 8]> <link rel="stylesheet" type="text/css" href="<?php echo yii::app()->request->baseurl; ?>/css/ie.css" media="screen, projection" /> <![endif]--> <link rel="stylesheet" type="text/css" href="<?php echo yii::app()->request->baseurl; ?>/css/main.css" /> <link rel="stylesheet" type="text/css" href="<?php echo yii::app()->request->baseurl; ?>/css/form.css" /> <link rel="stylesheet" type="text/css" href="<?php echo yii::app()->request->baseurl; ?>/css/custom.css" /> <link rel="stylesheet" type="text/css" href="<?php echo yii::app()->request->baseurl; ?>/css/bootstrap/bootstrap.css" /> <link rel="stylesheet" type="text/css" href="<?php echo yii::app()->request->baseurl; ?>/css/custom_bootstrap.css" /> <script type="text/javascript" src="<?php echo yii::app()->request->baseurl; ?>/js/jquery-2.1.1.min.js"></script> <script type="text/javascript" src="<?php echo yii::app()->request->baseurl; ?>/js/bootstrap.min.js"></script> <script type="text/javascript"> jquery(function() { $("a[data-toggle='tooltip']").tooltip(); }); </script> <title><?php echo chtml::encode($this->pagetitle); ?></title> </head> // body code fragment in same layout file------------------------------ <?php $this->widget('zii.widgets.cmenu', array( 'items' => array( array( 'url' => array('/site/login'), 'visible' => yii::app()->user->isguest, 'linkoptions' => array('class' => 'btn btn-default navbar-btn tooltip_element', 'data-toggle' => 'tooltip', 'title' => 'login', 'data-placement' => 'bottom')), ), 'linklabelwrapper' => 'span', 'linklabelwrapperhtmloptions' => array('class' => 'glyphicon glyphicon-log-in'), 'htmloptions' => array('class' => 'nav navbar-nav', ), )); ?>
i figured out how create work, added code.
instead this:
<link>...</link>
replace:
<?php $baseurl = yii::app()->request->baseurl; $cd = yii::app()->getclientscript(); $cd->registerscriptfile($baseurl . '/js/bootstrap.min.js'); ?>
twitter-bootstrap yii twitter-bootstrap-3
Comments
Post a Comment