jQuery 工具:带有类选择器的工具提示?
好吧,所以我不知道这里发生了什么...我正在尝试应用带有类作为选择器的工具提示。他们网站上的示例使用 和 ID 作为选择器,但这对我来说是不可能的,因为将有几个类似的对象需要工具提示。
http://flowplayer.org/tools/demos/tooltip/any-html.html
问题是,我需要在工具提示中使用 HTML...我不能只使用“标题”属性。
这是我正在处理的代码:
<ul id="mycarousel" class="jcarousel-skin-tango">
<?php $loop = new WP_Query( array( 'post_type' => 'staff', 'order' => 'ASC') ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li class="staff-member">
<img src="<?php print_custom_field('staff_photo:to_image_src'); ?>" width="135" height="200" />
</li>
<div class="tooltip">
<img src="http://static.flowplayer.org/img/title/eye.png" alt="Flying screens"
<?php the_title(); ?><br />
<?php print_custom_field('staff_position'); ?>
</div>
<?php endwhile; ?>
</ul>
如您所见,图像或 LI 需要是 ToolTip 挂钩...文档说 NEXT 元素被假定为 ToolTip 内容。 ...但这不起作用。
Alright, so I have no idea what's going on here... I'm trying to apply a ToolTip with a class as the selector. The examples on their website are using and ID as the selector, but that's not possible for me because there are going to be several similar objects that need the ToolTip.
http://flowplayer.org/tools/demos/tooltip/any-html.html
The thing is, I need HTML within the ToolTip... I can't just use the "title" attribute.
Here is code I'm dealing with:
<ul id="mycarousel" class="jcarousel-skin-tango">
<?php $loop = new WP_Query( array( 'post_type' => 'staff', 'order' => 'ASC') ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li class="staff-member">
<img src="<?php print_custom_field('staff_photo:to_image_src'); ?>" width="135" height="200" />
</li>
<div class="tooltip">
<img src="http://static.flowplayer.org/img/title/eye.png" alt="Flying screens"
<?php the_title(); ?><br />
<?php print_custom_field('staff_position'); ?>
</div>
<?php endwhile; ?>
</ul>
As you can see, the image or the LI needs to be the ToolTip hook... the documentation says that the NEXT element is assumed to be the ToolTip content. ... but it doesn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定这是否完全解决了您的问题,但要根据类在 jQuery 中选择元素,请使用以下语法:
$('.classname')
。因此,在您的示例中,它将是$('.tooltip')
有关不同 jQuery 选择器的更多信息,请查看 api 文档
Not sure if this fully solves your problem, but to select an element in jQuery based on the class, use this syntax:
$('.classname')
. Therefore in your example, it would be$('.tooltip')
For more info on the different jQuery selectors, check out the api documentation