问题
I need to provide a tool tip for a particular column in my table. My View:
<table class="tbl" id="dash" data-bind="with: Plan">
<thead>
<tr class="tag close">
<th>Type</th>
<th>Title</th>
</tr>
</thead>
<tbody class="scrollContent" data-bind="foreach: Course">
<tr>
<td><i class="icon"></i></td>
<td><a href="#" id="qtipselector_01" data-bind="text: Title"></a></td>
<div id="TooltipContent_01" class="hidden">
<a> Test Tool Tip</a>
</div>
</div>
</tr>
</tbody>
</table>
I have included jquery and jquery.qtip.js.
I have written a function to show the tool tip on mouse enter.
$('#qtipselector_01').qtip({
content: $('div#TooltipContent_01').html(),
position: {
my: 'left center'
},
show: 'mouseenter',
hide: {
fixed: true,
delay: 500,
when: {
event: 'unfocus'
}
},
style: {
tip: {
width: 20,
height: 14,
},
width:280,
height:100,
classes: 'qtipabc',
}
});
Main Page
<script src="Scripts/jquery.js" type="text/javascript"></script>
<script src="Scripts/jquery.qtip.js"></script>
<!--Template binding--><!-- This is where my view is getting binded-->
<div id="Container" ua-app-id="topVm" data-bind='template: {name: pageModel, data: pageVM }'>
</div>
<script src="Scripts/abc.js"></script> <!--Place where .qtip is called-->
Its not working as of now.
回答1:
$(document).ready(function(){
$('#qtipselector_01').qtip({
content: $('div#TooltipContent_01').html(),
position: {
my: 'left center'
},
show: 'mouseenter',
hide: {
fixed: true,
delay: 500,
when: {
event: 'unfocus'
}
},
style: {
tip: {
width: 20,
height: 14
},
width:280,
height:100,
classes: 'qtipabc'
}
});
});
You should place your qTip code within a $(document).ready block. Also, you have some extra commas in there that can interfere
来源:https://stackoverflow.com/questions/14529460/using-qtip-for-tool-tip-with-knockout