页面
加载后如何加载 jquery 对话框?我的意思是我不想每次刷新页面时都加载它。
我知道这与饼干有关。
这是我的对话
var $j = jQuery.noConflict();
$j(function(){
$j(document).ready(function(){
$j('#west').dialog({show: 'slow', modal: true, height: 600, width: 850, title: 'Price Comparison Popup', resizable: false, draggable: false});
});
});
我不确定我是否完全理解您的问题,但是如果您只想在代码中添加jquery-ui脚本,请使用以下内容:
//assuming you are working on a plugin
$plugin_url = plugins_url('myPlugin');
//register and enqueue the script
wp_register_script("jquery-dialog", $plugin_url . '/js/jquery.dialog.js', 'jquery');
wp_enqueue_style('jquery-dialog');
这将包括脚本,并确保它是在Wordpress的jQuery版本之后加载的。