jQuery Click 事件不适用于 jCarousel
这个问题的标题部分正确。单击事件适用于我在加载时显示的三个初始轮播项目。单击上一个或下一个后,新项目不会触发单击事件,如果 3 个原始项目移出屏幕,也不会触发单击事件。
我正在使用最新版本的 jquery,默认显示 3 项。我的目标是能够访问锚标记中包含的每个轮播项目内的文本。每个轮播项目都有一个图像和围绕标题的锚标记。
$('li').click(function() {
var clickedItem = $(this).attr('class');
console.log(clickedItem);
});
如果我能让这个简单的点击事件发生在其他元素上,一切都会很好。有什么想法吗?
The title to this question is partially true. The click events work for the three initial carousel items i display on load. Once you click previous or next the new items don't trigger the click event and neither do any of the 3 original items if they get moved off the screen.
I'm using the latest version of jquery and am displaying 3 items by default. My objective is to be able to access text inside each carousel item that is contained in an anchor tag. Each carousel item has an image, and an anchor tag surrounding a title.
$('li').click(function() {
var clickedItem = $(this).attr('class');
console.log(clickedItem);
});
If i can get this simple click event to occur on the other elements all will be good. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
Try this: