Widgets > wijtooltip > wijtooltip How To > Change the Location |
To change where the tooltip appears, use the position option like the following:
<script id="scriptInit" type="text/javascript">
$(document).ready(function () {
$("#tooltiptarget>a").wijtooltip({
showCallOut: true,
closeBehavior: 'sticky'
});
});
function applyPosition() {
$("#tooltiptarget>a").wijtooltip("option", "position", { my: $("#my1").get(0).value + " " + $("#my2").get(0).value, at: $("#at1").get(0).value + " " + $("#at2").get(0).value });
};
</script>
<div class="main demo">
<!-- Begin demo markup -->
<div id="tooltiptarget" class="ui-helper-reset ui-widget-header ui-corner-all" style="padding: 1em;">
<a href="#" title="tooltip">tooltip</a>
</div>
<!-- End demo markup -->
<div class="demo-options">
<!-- Begin options markup -->
<div style="height: 70px">
<div style="width: 180px; float: left;">
<span style="padding-right: 10px;">my:</span><select id="my1">
<option value="left">left</option>
<option value="center">center</option>
<option value="right">right</option>
</select>
<select id="my2">
<option value="top">top</option>
<option value="center">center</option>
<option value="bottom" selected="selected">bottom</option>
</select>
<br />
<span style="padding-right: 14px;">at:</span><select id="at1">
<option value="left">left</option>
<option value="center">center</option>
<option value="right" selected="selected">right</option>
</select>
<select id="at2">
<option value="top">top</option>
<option value="center">center</option>
<option value="bottom">bottom</option>
</select>
</div>
</div>
<input type="button" onclick="applyPosition();" value="apply" />
<!-- End options markup -->
</div>
</div>