【发布时间】:2017-03-26 04:08:06
【问题描述】:
尝试创建带有缩略图的轮播。点击缩略图时需要调用轮播函数。
import $ from 'jquery';
import 'react-bootstrap'
function changeSlide(){
$('[id^=carousel-selector-]').click(function () {
var id_selector = $(this).attr("id");
try {
var id = /-(\d+)$/.exec(id_selector)[1];
console.log(id_selector, id);
$('#myCarousel').carousel(parseInt(id));
} catch (e) {
console.log(e);
}
});
module.exports.changeSlide = changeSlide;
现在点击缩略图时出现控制台错误
TypeError: (0 , _jquery2.default)(...).carousel is not a function
at HTMLAnchorElement.<anonymous> (scripts.js:21)
at HTMLAnchorElement.dispatch (jquery.js:5206)
at HTMLAnchorElement.elemData.handle (jquery.js:5014)
【问题讨论】:
标签: javascript jquery twitter-bootstrap reactjs react-bootstrap