Advertisement
michaelyuen

Untitled

May 20th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4.   <meta charset="utf-8">
  5.   <meta name="viewport" content="width=device-width, initial-scale=1">
  6.   <title>jQuery UI Tooltip - Default functionality</title>
  7.   <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  8.   <link rel="stylesheet" href="/resources/demos/style.css">
  9.   <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  10.   <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  11. <script>
  12.   $( function() {
  13.         var desc;
  14.     $( document ).tooltip({
  15.       items: "[data-product]",
  16.       content: function() {
  17.         var element = $( this );
  18.         var id = $(this).attr('data-product');
  19.         var data = {pdid : id};
  20.                 $.ajax({
  21.                     type: "POST",
  22.                     url: "your.php",
  23.                     data: data,
  24.                     success: function(data) {
  25.                     desc = data;
  26.                     }
  27.                 })
  28.                 return desc;
  29.       }
  30.     });
  31.   } );
  32.   </script>
  33.   <style>
  34.   .photo {
  35.     width: 300px;
  36.     text-align: center;
  37.   }
  38.   .photo .ui-widget-header {
  39.     margin: 1em 0;
  40.   }
  41.   .map {
  42.     width: 350px;
  43.     height: 350px;
  44.   }
  45.   .ui-tooltip {
  46.     max-width: 350px;
  47.   }
  48.   </style>
  49. </head>
  50. <body>
  51.  
  52. <div class="something" data-product="9" title="test">Product 9</div>
  53. <div class="something" data-product="10">Product 10</div>
  54. <div class="something" data-product="11">Product 11</div>
  55.  
  56. </body>
  57. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement