"Colored Modal Headings"
Bootstrap 3.1.0 Snippet by seank1@mac.com

<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <h3>Colored Modal Headings<br /> <small>Headers that are a little more stylish.</small> </h3> <br /> <a class="btn btn-success" href="#success" data-toggle="modal"><h4><i class="glyphicon glyphicon-eye-open"></i> Success</h4></a> <!-- Modal --> <div class="modal fade" id="success" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header modal-header-success"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h1><i class="glyphicon glyphicon-thumbs-up"></i> Success Modal</h1> </div> <div class="modal-body"> </div> <div class="modal-footer"> <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <!-- Modal --> <a class="btn btn-primary" href="#primary" data-toggle="modal"><h4><i class="glyphicon glyphicon-eye-open"></i> Primary</h4></a> <!-- Modal --> <div class="modal fade" id="primary" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header modal-header-primary"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h1><i class="glyphicon glyphicon-thumbs-up"></i> Primary Modal</h1> </div> <div class="modal-body"> </div> <div class="modal-footer"> <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <!-- Modal --> <a class="btn btn-info" href="#info" data-toggle="modal"><h4><i class="glyphicon glyphicon-eye-open"></i> Info</h4></a> <!-- Modal --> <div class="modal fade" id="info" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header modal-header-info"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h1><i class="glyphicon glyphicon-thumbs-up"></i> Info Modal</h1> </div> <div class="modal-body"> </div> <div class="modal-footer"> <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <!-- Modal --> <a class="btn btn-warning" href="#warning" data-toggle="modal"><h4><i class="glyphicon glyphicon-eye-open"></i> Warning</h4></a> <!-- Modal --> <div class="modal fade" id="warning" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header modal-header-warning"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h1><i class="glyphicon glyphicon-thumbs-up"></i> Warning Modal</h1> </div> <div class="modal-body"> </div> <div class="modal-footer"> <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <!-- Modal --> <a class="btn btn-danger" href="#danger" data-toggle="modal"><h4><i class="glyphicon glyphicon-eye-open"></i> Danger</h4></a> <!-- Modal --> <div class="modal fade" id="danger" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header modal-header-danger"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h1><i class="glyphicon glyphicon-thumbs-up"></i> Danger Modal</h1> </div> <div class="modal-body"> </div> <div class="modal-footer"> <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <!-- Modal --> </div>
.modal-header-success { color:#fff; padding:9px 15px; border-bottom:1px solid #eee; background-color: #5cb85c; -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; } .modal-header-warning { color:#fff; padding:9px 15px; border-bottom:1px solid #eee; background-color: #f0ad4e; -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; } .modal-header-danger { color:#fff; padding:9px 15px; border-bottom:1px solid #eee; background-color: #d9534f; -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; } .modal-header-info { color:#fff; padding:9px 15px; border-bottom:1px solid #eee; background-color: #5bc0de; -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; } .modal-header-primary { color:#fff; padding:9px 15px; border-bottom:1px solid #eee; background-color: #428bca; -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; }

Related: See More


Questions / Comments:

How can I make, that the Modal will open if i "open" a site, like "index.php" or "news.php" ?

[BlaZZeR]BirD () - 10 years ago - Reply 0


You would need to use AJAX to load the contents in. Search on Google for AJAX modals in Bootstrap.

maxsurguy () - 10 years ago - Reply 0


Hmm, i dont know something about "AJAX", and i would like to use the Function like: "Modal::tellInfo("My Content", true, "My Header");" (die Button to click, ist not in the Function) and if i write this Code, the Modal should "pop up", but i don´t know how i can do it, i googled someting about "AJAX modals in Bootstrap", but its all "Copy&Paste", but i wan´t to learn it and not to Copy and Paste it.

[BlaZZeR]BirD () - 10 years ago - Reply 0


I recommend you get my book that tells all about that. Check it out at https://leanpub.com/frontend

maxsurguy () - 10 years ago - Reply 0


Thanks for the link, i read the Demo. Because i can´t buy this book ^^ and my english ist not so good that i would understand all of this :D

[BlaZZeR]BirD () - 10 years ago - Reply 0


Ah I see. What is your preferred language?

maxsurguy () - 10 years ago - Reply 0


My mother language is german ^^

[BlaZZeR]BirD () - 10 years ago - Reply 0


Awesome, I'll look for German translators when the book gains some popularity :)

maxsurguy () - 10 years ago - Reply 0


Okay, thanks :) But i haven't found a answer for my question.

Here is the paste from my function, (with the CSS Code from this function). There is a little discription so i hope you can help me.
Link: http://pastebin.com/PBCyL5UR

[BlaZZeR]BirD () - 10 years ago - Reply 0


Sorry, I think the paste has been removed. Are you still having the problem?

maxsurguy () - 10 years ago - Reply 0


[BlaZZeR]BirD () - 10 years ago - Reply 0


Sorry the Link obove doesn't work, new Link: http://pastebin.com/9A68DXHY

[BlaZZeR]BirD () - 10 years ago - Reply 0


I think the only thing you need to do is replace this line: }elseif($isTrue == true){?> with
if($isTrue){?>

And that should work.

maxsurguy () - 10 years ago - Reply 0


It already works, there is another function before that function. And thats not my problem ^^ you saw the Modal class. And now if I do
"Modal::tellSuccess("Thats my body", true, "Thats my header"); the Modal from this function should "pop up" (dunno how to descrip).

[BlaZZeR]BirD () - 10 years ago - Reply 0