在stackoverflow和wordpress.stackexchange.com中检查了一些相关问题之后,当我将下面的代码添加到我的header.php中时,我无法在我的wordpress网站中显示一个颜色框,在localhost中: / p>
<link rel="stylesheet" href="localhost/apoise/wp-content/themes/virality/colorbox-master/example1colorbox.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="localhost/apoise/wp-content/themes/virality/colorbox-master/jquery.colorbox.js"></script>
<script type="text/javascript">
jQuery.noConflict();
$(document).ready(function () {
$.colorbox({
width: 500,
height: 600,
href: "#colorbox_text"
)};
});
</script>
</head>
在帖子中,我放置了html:
<div id="colorbox_test" style="border: 1px solid black">
<p> This is supposed to display when the colorbox function is called </p>
</div>
任何帖子加载时都不显示任何框。我需要指定位置吗?或者是代码中的错误?
答案 0 :(得分:0)
我认为你的代码错了。尝试
$('#colorbox_test').colorbox({width: 500, height: 600});
您还希望熟悉您的浏览器javascript console以便将来调试。