我正在开发一个wordpress插件,其中我需要实现colorbox。我有以下代码。插件工作正常,但颜色框不起作用。我已经将相同的colorbox代码复制到一个html文件及其工作。唯一的问题是在wordpress插件。要么我没有完全导入js和css,要么其他任何东西都出错了。急需帮助。在wordpress插件中使用颜色框
<?php
/*
Plugin Name: my plugin
Plugin URI: http://www.xxx.com/
Description: xxx
Author: xxx
Version: 1.0
Author URI: http://www.xxx.com
*/
wp_enqueue_style('colorbox.css', '\wordpress\wp-
content\plugins\calc_plugin\colorbox.css');
wp_enqueue_script('jquery.js', '\wordpress\wp-content\plugins\calc_plugin\jquery.js',
array('jquery1'));
wp_enqueue_script('colorbox.js', '\wordpress\wp-
content\plugins\calc_plugin\colorbox.js', array('jquery2'));
function calc_form_markup() {
$markup = <<<EOT
<script>
$(document).ready(function(){
$(".inline").colorbox({inline:true, width:"600", height:"450"});
});
</script>
<div style='display:none' >
<div id='inline_content1' style='padding:10px; background:#fff;'>
<p><strong>This is inline content 1</strong></p>
<image src = "http://wallpaper.goodfon.com/image/240138-1360x768.jpg" width = "175"
height = " 150">
</div>
</div>
<p><a class='inline' href="#inline_content1">Inline HTML</a></p>
EOT;
return $markup;
}
add_shortcode('calc_form', 'calc_form_markup');
?>
我已经改变了文件,您的建议,已经包括了jQuery也。请看上面的代码现在它包含jquery,但colorbox仍然不能正常工作 – 2012-03-07 07:02:59