在 bxcarousel 中的图像上重新绑定 jQuery qtip 工具提示
我正在使用 bxcarousel 来显示一堆图像。每个图像都有一个工具提示,我使用 qtip 显示它。
这对于第一轮效果很好,但是当图像第二次出现时,工具提示不再显示(因为 bxcarousel 删除了滑出的元素并将其放回末尾)
可以在此处找到轮播的示例: http://www.kipdola.be/carousel/carousel.html
这是用于绑定事件的代码(也许它需要某个地方的“实时”函数?)
// Create the tooltips only on document load
$(document).ready(function()
{
// Use the each() method to gain access to each elements attributes
$('#shopcarousel a[rel]').each(function()
{
$(this).qtip(
I'm using bxcarousel to show a bunch of images. Each image has a tooltip, which I display using qtip.
This works fine for the first round, but when the images come round a second time the tooltips don't show anymore (because bxcarousel removes an element that slides out and puts it back at the end)
An example of the carousel can be found here:
http://www.kipdola.be/carousel/carousel.html
This is the code used to bind the events (maybe it needs a "live" function somewhere?)
// Create the tooltips only on document load
$(document).ready(function()
{
// Use the each() method to gain access to each elements attributes
$('#shopcarousel a[rel]').each(function()
{
$(this).qtip(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最终出于类似的目的修改了 bxCarousel。以下是我的步骤:
1.) 将另一个属性(animation_cb 或回调)添加到默认对象。该属性应用于传递一个回调函数,在每个动画周期的尾部执行:
2.)向slide_next和slide_prev函数添加对该选项的检查:
并且:
3.)最后,在您的插件初始化中调用时,传递一个要执行的回调函数。例如:
I ended up modifying bxCarousel for a similar purpose. Here are my steps:
1.) Add another property (animation_cb, or callback) to the defaults object. This property should be used to pass a callback function, to be executed at the tail end of each animation cycle:
2.) Add a check for the option to the slide_next and slide_prev functions:
And:
3.) Finally, in your plugin initialization call, pass a callback function to be executed. For example:
qTip 不能很好地处理
.live()
事件...我尝试了这样的方法:但效果不佳,因为有时您必须离开该元素然后再返回要显示的工具提示。
更好的选择是使用与
.live()
事件绑定的工具提示。我找不到很多,而且它们仍然相对基本:qTip doesn't work well with
.live()
events... I tried something like this:but it didn't work well because at times you would have to move off of the element then back for the tooltip to show.
A better alternative would be to use a tooltip that binds with
.live()
events. I couldn't find many, and they are still relatively basic: