Jquery thorws error on post back when finding .dynamic function
i am using jquery to show a tooltip popup the code i am using is below
<script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(MainEndRequestHandler);
$(MainEndRequestHandler);开发者_运维技巧
function MainEndRequestHandler(sender, args) {
loadeverthingmaster();
}
function loadeverthingmaster(){
try
{
$(".download_now").tooltip({
effect: 'slide',
delay:300
}).dynamic({ bottom: { direction: 'down', bounce: true } });
$(".help-bubble-link[title]").tooltip({
// tweak the position
offset: [10, 2],
// use the "slide" effect
effect: 'slide',
// add dynamic plugin with optional configuration for bottom edge
}).dynamic({ bottom: { direction: 'down', bounce: true } });
}
catch(err)
{
alert(err);
}
}
</script>
but when i load my page i get this error
TypeError: $(".download_now").tooltip({effect: "slide", delay: 300}).dynamic is not a function
I have no clue why this is happening. anyone got any idea or solutino...
Regards
Check the order you import your script in. Make sure this script tag is below the jquery-tooltip plugins import. Also make sure jquery and jquery-ui are imported above the jquery-tooltip plugins. Also you may want to try wrapping this code with document.ready() to make sure all script is loaded like:
<script type="text/javascript">
$(document).ready(function(){
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(MainEndRequestHandler);
$(MainEndRequestHandler);
function MainEndRequestHandler(sender, args) {
loadeverthingmaster();
}
function loadeverthingmaster(){
try
{
$(".download_now").tooltip({
effect: 'slide',
delay:300
}).dynamic({ bottom: { direction: 'down', bounce: true } });
$(".help-bubble-link[title]").tooltip({
// tweak the position
offset: [10, 2],
// use the "slide" effect
effect: 'slide',
// add dynamic plugin with optional configuration for bottom edge
}).dynamic({ bottom: { direction: 'down', bounce: true } });
}
catch(err)
{
alert(err);
}
}
});
</script>
To make sure you have the proper libraries you could also try swapping the jquery import and the jquery tools import with this import that contains jquery + jquery tools + dynamic plugin:
<!-- jQuery Library + ALL jQuery Tools -->
<script src="http://cdn.jquerytools.org/1.2.5/full/jquery.tools.min.js"></script>
Also try:
$(".help-bubble-link['title']").tooltip({ //notice change in this line
// tweak the position
offset: [10, 2],
// use the "slide" effect
effect: 'slide',
// add dynamic plugin with optional configuration for bottom edge
}).dynamic({ bottom: { direction: 'down', bounce: true } });
精彩评论