繁体   English   中英

无法在wordpress站点中显示jquery插件的颜色框

[英]Unable to display a jquery plugin's colorbox in a wordpress site

在stackoverflow和wordpress.stackexchange.com中检查了一些相关问题之后,当我将下面的代码添加到我的header.php中时,我无法在我的wordpress网站中显示一个颜色框,在localhost中:

<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>

任何帖子加载时都不显示任何框。 我需要指定位置吗? 或者是代码中的错误?

我认为你的代码是错误的。 尝试

$('#colorbox_test').colorbox({width: 500, height: 600});

您还需要熟悉浏览器的javascript控制台,以便将来进行调试。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM