Advertisement
Guest User

Weather Bootstrap

a guest
Nov 13th, 2014
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <body>
  5.     <meta charset="utf-8">
  6.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7.     <meta name="viewport" content="width=device-width, initial-scale=1">
  8.     <script src="http://code.jquery.com/jquery-2.0.0.js"></script>
  9.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
  10.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap-theme.min.css">
  11.     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
  12.     <script language="javascript" type="text/javascript">
  13.  
  14. //Function
  15.  
  16. function foo(callback) {
  17.     $.ajax({
  18.     url: "http://api.openweathermap.org/data/2.5/weather?q=London",
  19.     dataType: 'JSON',
  20.     success: callback
  21.     });
  22. }
  23.  
  24. function myCallback(result) {
  25. var temp = JSON.stringify(JSON.parse(result.main.temp));
  26. var Kelvin = 272;
  27. var Centigrade = temp-Kelvin;
  28. $('span.temp-val').text(Centigrade);
  29. }
  30.  
  31.  
  32. $(document).ready(function(){
  33.     $(".popover-examples a").popover({
  34.         title : 'Weather App',
  35.         trigger: 'hover',
  36.         template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div><img src="http://lorempixel.com/100/100" /><span class="temp-val">Just an example of inserting image in a Popover...</span></div>'
  37.     });
  38.    
  39.     $(".popover-examples a").hover(function() { myCallback(); })
  40. });
  41.     </script>
  42.     <div class="bs-example">
  43.     <p class="popover-examples">
  44.         <a href="#" class="btn btn-lg btn-primary" data-toggle="popover" >Popover Example</a>
  45.     </p>    
  46. </div>
  47. </body>
  48.  
  49.  
  50. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement