logo
down
shadow

Show variable content in bootstrap tooltip


Show variable content in bootstrap tooltip

By : lamya_94
Date : November 22 2020, 09:00 AM
may help you . Have you considered adding ui.bootstrap as a dependency in your module? This will allow you to get bootstrap features through angular. Here is an example using a dynamic tooltip (uib-tooltip). More bootstrap examples can be found at: http://angular-ui.github.io/bootstrap/
code :
angular.module('myApp', ['ui.bootstrap'])
  .controller('MainController', function ($scope) {
    var pump = {};
    $scope.pump = pump;
  
    pump.state="off";
  
    pump.setState = function (state) {
      pump.state = state;
    }
  });
.pump-image {
  background: url('https://gauchedecombat.files.wordpress.com/2012/05/on-off.png') no-repeat;
  height: 270px;
  width: 262px;
}

.on {
  background-position: 0 0;
}

.off {
  background-position: -262px 0;
}
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.14.3/ui-bootstrap-tpls.js"></script>
<div ng-app="myApp" ng-controller="MainController as ctrl">
  <input type="radio" ng-model="pump.state" value="off" />Off
  <input type="radio" ng-model="pump.state" value="on" />On
  <div uib-tooltip="Pump: {{pump.state}}" class="pump-image" ng-class="{on: pump.state === 'on', off: pump.state==='off'}" tooltip-placement="right"></div>
</div>


Share : facebook icon twitter icon
Bootstrap tooltip with angularjs using $http to load the content of the tooltip

Bootstrap tooltip with angularjs using $http to load the content of the tooltip


By : yang
Date : March 29 2020, 07:55 AM
it helps some times Ok so calling .tooltip() before the AJAX call might seem like a good idea, but the method copies the data-original-title or 'title'into its internal variables so we can't change it :(.
the thing is that calling tooltip() it just listens to onmouseover events. You have to call .tooltip('show') to make it appear programmatically.
code :
var app =  angular.module("myApp", [])
app.directive('popOver', function($http) {
 return {
  restrict: 'C',
  link: function(scope, element, attr) {
    var i =0;
    element.tooltip();
    $(element).bind('mouseover',function(e) {

        $http.get("test").success(function(){
           attr.$set('originalTitle', "Some text "+i++);  
            element.tooltip('show');
         });
        });
   }
 }
});
Set the content of Bootstrap tooltip via Javascript

Set the content of Bootstrap tooltip via Javascript


By : user2006440
Date : March 29 2020, 07:55 AM
I hope this helps . I have included tooltips in my table's cells. Here is how I did it: , I haven't tested it, but something like this should work.
code :
$('.table td').each(function () {
    var title = $(this).attr('data-original-title').split('.');
    $(this).attr('data-original-title', dic1[title[0]] + ' ' +
        dic2['0.' + title[1]] + ' (' + title[0] + '.' + title[1] + ')');
});
Bootstrap tooltip doesn't show style of the tooltip, only data

Bootstrap tooltip doesn't show style of the tooltip, only data


By : user2216705
Date : March 29 2020, 07:55 AM
help you fix your problem Here's a working template for you. My guesses as to what was wrong:
jQuery always needs to come before bootstrap.js. If you don't have a local server running, you need to add the http: to the CDN addresses. You may have been trying to initialize the tooltip in the head tags. Problem is that the document probably wasn't ready.
code :
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
    <a href="#" data-toggle="tooltip" title="Some tooltip text!">Hover over me</a>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
    <script>
    $( document ).ready(function() {
        $('[data-toggle="tooltip"]').tooltip({'placement': 'top'});
    });
    </script>
  </body>
</html>
Bootstrap tooltip on AJAX content

Bootstrap tooltip on AJAX content


By : arktouros
Date : March 29 2020, 07:55 AM
hop of those help? Ok i found an answer just after i posted the question:
Here it is, as it is a bit frustrating sometime:
code :
$('body').tooltip({
    selector: '[rel=tooltip]'
});
Bootstrap tooltip would not show up

Bootstrap tooltip would not show up


By : Clayton Chase
Date : March 29 2020, 07:55 AM
may help you . Yes, i know this is a duplicate, but all the answers i've read didn't help me, i have a side by side working example, from w3school, it works, and mine doesn't, what i am trying to do is show a tooltip warning the user to use numbers only, but instead, it just refreshes the page. , There are few mistakes in your code,
code :
//it should be title: and not title=
 $('#search-form').tooltip({title:"You did good :)"});
var previous;

        //Buy Button JS code
        $(function () {
            $("#searchform").bind('submit', function () {
              var newTooltip="";
                var str = $('#search-form').val();
                if (str.match(/^[0-9]*$/)) {
                    newTooltip = "You did good :)";
                }
                else
                {
                    newTooltip = 'Please enter numbers ONLY !';                     
                }
              
              $('#search-form').attr('title', newTooltip).tooltip('fixTitle').tooltip('setContent').tooltip('show');
              setTimeout(function(){
               $('#search-form').tooltip('hide').tooltip('destroy');
                }, 1500);
              
            });

          
        });
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

/*---not using the bootstrap css because it messes up the form layout, so i copied every tooltip referenced block to my style.css instead.---*/

 <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>


<div class="box">
    <form class="search-form" method="post" id="searchform">
        <input type="text" id="search-form" name="textbox" placeholder="Please enter your code" required/>
        <button type="submit" name="submit" class="btntxt">Validate</button>
        <div id="search_results"></div>

    </form>
</div>
Related Posts Related Posts :
  • Resize images to fit display:flex divs
  • Three layers transparency
  • HTML side by side divs, while one has fixed width and the second one fits remaining space
  • DIV Stacking & Spacing Using CSS
  • How to make space between menu items in CSS/HTML
  • CSS display:flex equal parts
  • Image Caption Hover Animation in html or/and css
  • How can I create an alignment toward the top left corner?
  • Page is showing two scrollbars
  • Z-index issues - How to bring a child element onto the parent's below element?
  • Ingesting videos via bulk uploading into Azure media services from HTML5
  • border-radius with dropdown menu
  • Is there an HTML entity for an info icon?
  • Style two html form text area/inputs on same page differently
  • Bootstrap 3 Grid Layout not respecting blank "Margin" columns?
  • HTML tag with different attributes
  • CSS Clear depending on odd of even amount of items
  • Center div on wrapping (when it doesn't fit on the line)
  • How to remove blank space around SVG
  • Vertical Align Bootstrap Radio Button Image
  • Bootstrap HTML carriage return
  • CSS Checkbox Styling Behaving Differently on Other Pages
  • How to keep a link disable when it's still on the same page
  • Container div overlapping child horizontally
  • How to set both a background colour and a different text color on the same element
  • How to vertically & horizontally center children elements in a fluid layout set by media queries?
  • Layer responsive images on top of each other with Bootstrap
  • Is there a way to hide html inside curly braces in an ASP.NET MVC Razor html helper?
  • How to reference to WIN32 object under MS Windows 7 64bit in VBScript
  • Center inline-block list
  • Background image isn't showing up. Why?
  • CSS Click after transform
  • CSS Button Animation - How to Accomplish?
  • How to find out which favicon a browser actually uses
  • CSS Media Queries Overriding Each other
  • Cycle2 Carousel not working when it's in a DIV
  • HTML to landscape MS Word
  • Reduce the background simultaneously as site reduction - Bootstrap
  • How to set vertical align of elements that exist into a div tag to center with css?
  • I'm resizing an image while scrolling in my website, but i cant figure how to make an animation for the resizing
  • How to style up a hr tag
  • vertical scrolling blocked by Hammer.js
  • Site layout breaks on mobile view
  • I'm missing something in my Head to make the site responsive
  • Fluid/fixed design with sidebar composed of two items
  • Squeeze a div between two other divs when window resizes
  • Short form for expression <label>
  • Align :before with text both with same height
  • Handlebars not populating data after first space in input field
  • CSS3 sprite animation for different size
  • Css not working(rendering) in chrome/firefox but works in IE10/Edge
  • Centering bootstrap responsive columns
  • Basic CSS floating elements behavior
  • Trigger HTML event with VBA
  • Custom Skin: How to get Languages into MediaWiki Sidebar?
  • URL pathway is wrong
  • How to set align of elements to center with css?
  • Bootstrap : vertical align and jumbotron height
  • Relative vs Absolute in CSS
  • Flexbox Grid Container
  • shadow
    Privacy Policy - Terms - Contact Us © animezone.co