javascript - including predefined buttons from the footer in the Bootstrap popover -
i've used bootstrap make header , footer responsive. when resize app buttons have collapse effect. footer buttons want different. want them pop out in popover effect. ones on twitter. don't know how include created buttons footer in popover. hope guys understand poor explanations :)
$(function (){ $("[data-toggle = 'popover']").popover(); });
body { min-height: 2000px; } #navbar-main { background: #017f55; border:1px solid #000; border-radius: 0; } #title { color:#000; font-size: 43px; top:7px; } #select { color:#000; height:30px; } #nav-footer { background: #017f55; display:inline; text-align: right; border:1px solid #000; } .footer-buttons { display:inline; font-size: 20px; padding-right: 20px; background-color: #017f55; } .icon-bar{ border: 1px solid #fff; } #footer-navbar { border-color: #000; } .footer-buttons { background-color: #017f55; } #footer-button { border:1px solid #333 } #footer-button:hover { background-color: #333; } #footer-button:active { background-color: #333333; }
<!doctype html> <html> <head> <title>code test</title> <link rel="stylesheet" type="text/css" href="css/main.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script src="js/script.js"></script> <!-- latest compiled , minified css --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mtjoasx8j1au+a5wdvnpi2lkffwweaa8hdddjzlplegxhjvme1fgjwpgmkzs7" crossorigin="anonymous"> <!-- optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-flw2n01lmqjakbkx3l/m9eahuwpsfenvv63j5ezn3uzzapt0u7eysxmjqv+0en5r" crossorigin="anonymous"> </head> <body> <nav id="navbar-main" class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <img src="images/test_logo.png"> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav center"> <li><a href="#index" id="title">code test</a></li> <li><a> <select id="select"> <option value="english">english</option> <option value="devanagari">devanagari</option> </select> </a></li> </ul> </div><!--/.nav-collapse --> </div> </nav> <nav id="nav-footer" class="navbar navbar-default navbar-fixed-bottom"> <div id="footer" class="container2"> <div class="navbar-header"> <button id="footer-button" type="button" class="navbar-toggle collapsed" data-toggle="popover" data-target="#footer-navbar" > <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div id="footer-navbar" class="navbar-inner navbar-content-center collapse navbar-collapse"> <button class="btn footer-buttons">about</p> <button class="btn footer-buttons">feedback</p> </div> </div> </nav> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0msbjdehialfmubbqp6a4qrprq5ovfw37prr3j5elqxss1yvqotnepnhvp9aj7xs" crossorigin="anonymous"></script> </body> </html>
you can achieve activating html
option of bootstrap popover, , setting content dynamically using content
property, follows:
$(document).ready(function() { $("[data-toggle = 'popover']").popover({ html: 'true', content : '<button class="btn footer-buttons">about</button> ' + '<button class="btn footer-buttons">feedback</button>' }); });
you can dynamically read buttons or other html html markup , insert popover, follows:
$(document).ready(function() { $("[data-toggle = 'popover']").popover({ html: 'true', content : $("#footer-navbar").html() }); });
i changed html markup did not close button
tag properly. check out working example in codepen
Comments
Post a Comment