Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <td class="long-data">
- <span class="tooltip">16 This Street Avenue, That Suburb, Some City, 1000</span>
- </td>
- <script>
- // shorten data and display the full content as a tooltip
- // code based on this JSFiddle http://jsfiddle.net/Handyman/fNjFF/11/
- var longdatacellvalue;
- $(document).on("ready", function () {
- var longdatacell = $("td.long-data");
- longdatacellvalue = longdatacell.html();
- // shorten data to 20 characters long
- longdatacell.html(longdatacellvalue.substring(0, 20));
- $(".tooltip").attr("title", longdatacellvalue);
- });
- $(".long-data").tooltip({ // errors here "Object doesn't support this property or method"
- items: 'span.tooltip',
- content: longdatacellvalue,
- show: null,
- open: function (event, ui) {
- if (typeof (event.originalEvent) === "undefined") {
- return false;
- }
- var $id = $(ui.tooltip).attr("id");
- // close any lingering tooltips
- $("div.ui-tooltip").not("#" + $id).remove(); // don't know where this div comes from?
- },
- close: function (event, ui) {
- ui.tooltip.hover(function () {
- $(this).stop(true).fadeTo(400, 1);
- },
- function () {
- $(this).fadeOut("400", function () {
- $(this).remove();
- });
- });
- }
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement