Jquery 鼠标悬停上的工具提示首次不起作用
我已经尝试了stackoverflow中给出的许多解决方案,但它对我不起作用 我的代码:Jquery 鼠标悬停上的工具提示首次不起作用,jquery,angularjs,tooltip,Jquery,Angularjs,Tooltip,我已经尝试了stackoverflow中给出的许多解决方案,但它对我不起作用 我的代码: <circle cx="847.1614583333333" cy="336.66666666666663" r="10" id="b63a9673-7f08-4563-96a5-78566a12a15c" onmouseover="hotspot_thumbnail('b63a9673-7f08-4563-96a5-78566a12a15c')" stroke="#000000"
<circle cx="847.1614583333333" cy="336.66666666666663" r="10"
id="b63a9673-7f08-4563-96a5-78566a12a15c"
onmouseover="hotspot_thumbnail('b63a9673-7f08-4563-96a5-78566a12a15c')"
stroke="#000000" fill="#000000" stroke-width="0"
data-pdf-annotate-id="b63a9673-7f08-4563-96a5-78566a12a15c"
data-pdf-annotate-type="fillcircle" aria-hidden="true"
transform="scale(0.6) rotate(0) translate(0, 0)"
style="cursor: pointer;"
data-toggle="tooltip" data-placement="bottom"
data-trigger="hover" title="hover"></circle>
我的角度控制器代码:
在控制器中的一个函数内
$scope.$apply(function () {
$scope.heading_hover = spot.hotspot_hover.split('/').pop()
$scope.hover_img = spot.hotspot_hover
var annote = document.getElementById(uuid);
annote.setAttribute('data-toggle','tooltip')
annote.setAttribute('data-placement','bottom')
annote.setAttribute('data-trigger','hover')
annote.setAttribute('title','hover')
$("#"+$scope.uuid_hover).tooltip({ content: '<img src="'+$scope.hover_img+'">' });
})
tool();
$scope.$apply(函数(){
$scope.heading_hover=spot.hotspot_hover.split('/').pop()
$scope.hover\u img=spot.hotspot\u hover
var annote=document.getElementById(uuid);
annote.setAttribute('data-toggle','tooltip'))
annote.setAttribute('data-placement','bottom')
annote.setAttribute('data-trigger','hover')
annote.setAttribute('title','hover')
$(“#”+$scope.uuid_hover);
})
工具();
在第一次悬停时,它不工作,但在第二次悬停时,它工作良好
我试过这个:
当您尝试时发生了什么-您在哪里调用工具提示?您需要在页面加载时调用它,而不是在某些其他事件中。我从角度控制器调用您知道。tooltip(没有显示工具提示,只是初始化它?因此您需要调用。tooltip(当您加载页面而不是在某些鼠标事件中)我调用工具();当页面加载时
$scope.$apply(function () {
$scope.heading_hover = spot.hotspot_hover.split('/').pop()
$scope.hover_img = spot.hotspot_hover
var annote = document.getElementById(uuid);
annote.setAttribute('data-toggle','tooltip')
annote.setAttribute('data-placement','bottom')
annote.setAttribute('data-trigger','hover')
annote.setAttribute('title','hover')
$("#"+$scope.uuid_hover).tooltip({ content: '<img src="'+$scope.hover_img+'">' });
})
tool();