javascript - Make a popover over a table -
i want make popover covers table
<!doctype html> <html> <head> <title>js bin</title> <script src="https://code.jquery.com/jquery.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <style> .popover { width: 2000px; } .popover-table th, td { padding: 0px 15px; white-space:nowrap; } </style> </head> <body> <a href="#" data-toggle="popover4">4</a> <div id="popover4-html" style="display: none"> abcdefghi: <table class="popover-table"> <tr></tr> <tr> <th>alongtitleisverylong</th> <th>linked event3</th> <th>100 lines</th> </tr> <tr> <td>jill</td> <td>smith</td> <td>50</td> </tr> </table> </div> <script> $('[data-toggle="popover4"]').popover({ html: true, content: function() { return $("#popover4-html").html() }}); </script> </body> </html>
there 2 problems:
1) width of popover cannot cover width of table
2) don't want bold first row of table, don't know how it
could help?
you can use following code
<!doctype html> <html> <head> <title>js bin</title> <script src="https://code.jquery.com/jquery.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <style> .popover { width: 2000px; max-width:50% } .popover-table th, td { padding: 0px 15px; white-space:nowrap; } </style> </head> <body> <a href="#" data-toggle="popover4">4</a> <div id="popover4-html" style="display: none"> abcdefghi: <table class="popover-table"> <tr></tr> <tr> <td>alongtitleisverylong</td> <td>linked event3</td> <td>100 lines</td> </tr> <tr> <td>jill</td> <td>smith</td> <td>50</td> </tr> </table> </div> <script> $('[data-toggle="popover4"]').popover({ html: true, content: function() { return $("#popover4-html").html(); }}); </script> </body> </html>
the <th>
tag bold text within have replaced <td>
tag.
the max-width in popover class has been given 276px in bootstrap.css have overridden replacing max-width:50%.
Comments
Post a Comment