te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>javascript - Why are my bootstrap tooltips not working? - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Why are my bootstrap tooltips not working? - Stack Overflow

programmeradmin3浏览0评论

Bevor i use a plugin for Bootstrap i always test it before. This is why my html is so simple. It would be great if you could help me out with my tooltips.

Ps: i am really new to coding Websites

HTML:

<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap-Basis-Vorlage</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="Tooltip links">Tooltip links</button>

<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>


<script src=".11.3/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>


</body>
</html>

Bevor i use a plugin for Bootstrap i always test it before. This is why my html is so simple. It would be great if you could help me out with my tooltips.

Ps: i am really new to coding Websites

HTML:

<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap-Basis-Vorlage</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="Tooltip links">Tooltip links</button>

<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>


<script src="https://ajax.googleapis./ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>


</body>
</html>
Share Improve this question asked Nov 16, 2015 at 15:22 Johannes GetznerJohannes Getzner 611 gold badge1 silver badge8 bronze badges 5
  • Include latest jquery version – Nenad Vracar Commented Nov 16, 2015 at 15:24
  • It is working jsfiddle/2Lzo9vfc/91 – Nenad Vracar Commented Nov 16, 2015 at 15:25
  • i don't get it. This is making me like really mad – Johannes Getzner Commented Nov 16, 2015 at 15:26
  • 1 You use jQuery on document ready to call your code, but you do it before jQuery is loaded. Therefore it won't execute. Put jQuery script first, then your custom code after. Where you want to put your bootstrap script(before/after custom code) is optional. – turbopipp Commented Nov 16, 2015 at 15:37
  • i still get the same result – Johannes Getzner Commented Nov 16, 2015 at 15:46
Add a ment  | 

3 Answers 3

Reset to default 6

Try this code

<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap-Basis-Vorlage</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="Tooltip links">Tooltip links</button>




    <script src="https://ajax.googleapis./ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script>
        $(function () {
            $('[data-toggle="tooltip"]').tooltip();
        });
    </script>

</body>
</html>

my first attempt to resolve bootstrap tooltip issues is to change the selector

$(document).ready(function() {
    $("body").tooltip({ selector: '[data-toggle=tooltip]' });
});

it's also possible that the tooltip is working, but isn't placed in front of your div

.tooltip({ container: 'body' }) 

https://stackoverflow./a/31811884/3511012

Why are my bootstrap tooltips not working?

Because you initialize the jquery and bootstrap scripts after the code where you try to initialize the tooltip via jQuery. Swap them around. Scripts first, then your custom code.

发布评论

评论列表(0)

  1. 暂无评论