老师,这一节点击模态框的时候报错了
来源:5-6 借助 BootStrap 4-x 搭建网站首页
小题莫小题莫
2018-01-26
script.
var player = null
$(document).ready(function(){
$('#myModal').on('hidden.bs.modal', function(e){
if(player && player.pause) player.pause()
})
$('.card-img-top').click(function(e){
var video = $(this).data('video')
var image = $(this).attr('src')
$('#myModal').modal('show')
if(!player){
player = new DPlayer({
container: document.getElementById('videoModal'),
screenshot: true,
video: {
url: video,
pic: image,
thumbnails: image
}
})
} else {
if (play.video.currentSrc !=video) {
player.switchVideo({
url: video,
pic: image,
type: 'auto'
})
}
}
})
})运行后报错:
(index):85 Uncaught TypeError: $(...).modal is not a function
写回答
1回答
-
小题莫小题莫
提问者
2018-01-26
老师 我给js加上 text/javascript 就可以了,为什么你的视频不加这个也不报错
012018-01-28
相似问题