2016-08-08 6 views
1

最初のボタンと2番目のボタンにポップオーバーツールチップを配置するにはどうすればよいですか?ボタンにブートストラップポップオーバーツールチップを挿入する方法

<div class="btn-group pull-right" data-toggle="buttons" style="top:26px;z-index:2;"> 
<label class="make-small btn btn-default" id="first_button_func"> 
<span>First Button</span> 
</label> 
<label class="make-small filter-column btn btn-default active"> 
<input type="checkbox" autocomplete="off" checked=""> <span>Second Button</span> 
</label> 
</div> 

私はtooltipsで説明したように

+0

http://v4-alpha.getbootstrap.com/components/tooltips /読んでください – dinesh

答えて

0

"これは最初のボタンである" あなたは

  • data-toggle="tooltip"
  • を追加する必要がツールチップのようなものを必要とします
  • title="...."

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> 
 
<script src="https://code.jquery.com/jquery-1.12.1.min.js"></script> 
 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> 
 

 
<div class="btn-group pull-right" data-toggle="buttons" style="top:26px;z-index:2;"> 
 
    <label class="make-small btn btn-default" id="first_button_func" data-toggle="tooltip" title="Tooltip test for First Button"> 
 
     <span>First Button</span> 
 
    </label> 
 
    <label class="make-small filter-column btn btn-default active" data-toggle="tooltip" title="Tooltip test for Second Button"> 
 
     <input type="checkbox" autocomplete="off" checked=""> <span>Second Button</span> 
 
    </label> 
 
</div>

0

<!DOCTYPE html> 
 
<html lang="en"> 
 
<head> 
 
<meta charset="UTF-8"> 
 
<title>Example of Bootstrap Popover with Close Button</title> 
 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> 
 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css"> 
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 
 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> 
 
<script type="text/javascript"> 
 
$(document).ready(function(){ 
 
    $('[data-toggle="popover"]').popover({ 
 
     placement : 'top', 
 
     html : true, 
 
     title : 'User Info <a href="#" class="close" data-dismiss="alert">×</a>', 
 
     content : '<div class="media"><a href="#" class="pull-left"><img src="../images/avatar-tiny.jpg" class="media-object" alt="Sample Image"></a><div class="media-body"><h4 class="media-heading">Jhon Carter</h4><p>Excellent Bootstrap popover! I really love it.</p></div></div>' 
 
    }); 
 
    $(document).on("click", ".popover .close" , function(){ 
 
     $(this).parents(".popover").popover('hide'); 
 
    }); 
 
}); 
 
</script> 
 
<style type="text/css"> 
 
\t .bs-example{ 
 
    \t margin: 200px 150px 0; 
 
    } 
 
    .popover-title .close{ 
 
     position: relative; 
 
     bottom: 3px; 
 
    } 
 
</style> 
 
</head> 
 
<body> 
 
<div class="bs-example"> 
 
    <button type="button" class="btn btn-primary" data-toggle="popover">First </button> 
 
    <br/> <br/> 
 
    <button type="button" class="btn btn-primary" data-toggle="popover">Second </button> 
 
</div> 
 
</body> 
 
</html>         \t \t

0
<div class="btn-group pull-right" data-toggle="buttons" style="top:26px;z-index:2;"> 
<label class="make-small btn btn-default" id="first_button_func"> 
<span data-toggle="tooltip" data-placement="left" title="This is the first button">First Button</span> 
</label> 
<label class="make-small filter-column btn btn-default active"> 
<input data-toggle="tooltip" data-placement="left" title="This is the second button" type="checkbox" autocomplete="off" checked=""> <span>Second Button</span> 
</label> 
</div> 

これは、JSファイルに追加...

$('[data-toggle="tooltip"]').tooltip(); 
関連する問題