jquery: (newbie) trying to get a tooltip to work -
i using example code here:
http://jsfiddle.net/tj_vantoll/kybwu/
but since don't want user decide arrow comes - setting arrow myself position. since not using textbox, want tool tip display mouses on image class name "hide-option"
my modified code:
<script> $(function() { var position = { my: 'left center', at: 'right+10 center' }; position.collision = 'none'; $('.hide-option').tooltip('option', 'position', position); $('.hide-option').tooltip('option', 'tooltipclass', classname); $('.hide-option').tooltip(); }); </script>
my html:
<img src="siteimgs/comments_icon.png" class="hide-option" title="total comments: 80" >
but not work, gives me error in console: "uncaught error: cannot call methods on tooltip prior initialization; attempted call method 'option' "
since newbie, have no idea went wrong... can me work and tell me went wrong please?
the css same 1 on jsfiddle.
well in example $('input[type="text"]').tooltip();
called before setting options.
you should this:
$('.hide-option').tooltip(); $('.hide-option').tooltip('option', 'position', position); $('.hide-option').tooltip('option', 'tooltipclass', classname);
Comments
Post a Comment