Browse Source

Merge pull request #232 from tabacha/feature_mouseOverButton

Allow a mouseOver text for buttons
Dante 9 years ago
parent
commit
9bad0c6543
2 changed files with 10 additions and 2 deletions
  1. 5 2
      examples/index.html
  2. 5 0
      src/js/bootstrap-dialog.js

+ 5 - 2
examples/index.html

@@ -6,7 +6,7 @@
 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
 <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.9/css/bootstrap-dialog.min.css" rel="stylesheet" type="text/css" />
-<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.9/js/bootstrap-dialog.min.js"></script>
+<script src="../dist/js/bootstrap-dialog.min.js"></script>
 <meta charset="utf-8" />
 <title>BootstrapDialog examples</title>
 <style>
@@ -145,9 +145,11 @@
         BootstrapDialog.show({
             message: 'Hi Apple!',
             buttons: [{
-                label: 'Button 1'
+                label: 'Button 1',
+                title: 'Mouse over Button 1'
             }, {
                 label: 'Button 2',
+                // no title as it is optional
                 cssClass: 'btn-primary',
                 action: function(){
                     alert('Hi Orange!');
@@ -155,6 +157,7 @@
             }, {
                 icon: 'glyphicon glyphicon-ban-circle',
                 label: 'Button 3',
+                title: 'Mouse over Button 3',
                 cssClass: 'btn-warning'
             }, {
                 label: 'Close',

+ 5 - 0
src/js/bootstrap-dialog.js

@@ -837,6 +837,11 @@
                 $button.append(button.label);
             }
 
+            // title
+            if (typeof button.title !== 'undefined') {
+                $button.attr('title',  button.title);
+            }
+
             // Css class
             if (typeof button.cssClass !== 'undefined' && $.trim(button.cssClass) !== '') {
                 $button.addClass(button.cssClass);