【发布时间】:2016-10-14 13:49:32
【问题描述】:
这是我的代码,AJAX 成功调用中的“滑动”事件。
success: function(data) {
$('#my_container').html(data);
// I am getting' #mycarousel' successfully in to #my_container
$('#mycarousel').bind('slid', function(e) {
console.log('hi');
}
// tried 'slid.bs.carousel' too, no change.
// btw, I can see my 'slid' function under event listeners for that element.
// when I paste the above binding code in console again it shows the element too.
});
我想在 slid 事件上打印 'hi' 到控制台,但现在无法正常工作。
谢谢
【问题讨论】:
-
我只想打印“console.log('hi');”
-
这是你所问的一个有效的小提琴:jsfiddle.net/faw242a8你的问题可能在代码的其他地方。等等,我看到了,您正在通过 ajax 加载轮播...
标签: javascript jquery ajax twitter-bootstrap bootstrap-carousel