【发布时间】:2019-04-26 18:16:04
【问题描述】:
我正在为 jQuery 使用 Colorbox。我从http://www.jacklmoore.com/colorbox/下载了插件
下面是我的 jQuery 代码:
<script type="text/javascript">
$('#gallery').colorbox();
</script>
HTML 代码:
<!doctype html>
<html lang="en">
<head>
<title>JQuery - Chapter 4</title>
<link rel="stylesheet" href="CSS/colorbox.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="JS/jquery.colorbox.js"></script>
<script src="JS/jquery-3.3.1.js"></script>
</head>
<body>
<a id="gallery" href="images/dog.jpeg">Dog</a>
<a id="gallery" href="images/horse.jpg">Horse</a>
<a id="gallery" href="images/tree.jpg">Tree</a>
</body>
当我单击图像名称时,它不会触发 colorbox() 方法。而是将我带到图像源。
谢谢
【问题讨论】:
标签: jquery jquery-ui jquery-plugins