最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jQueryUI draggable doesn't work in Wordpress plugin

programmeradmin3浏览0评论

I'm making a simple plugin in wordpress that shows a draggable element.Here is my code:

<?php
/** 
* @package jqcfc
*/
/*
Plugin Name: cfc jq
*/

function page_jq() {
?>
<!DOCTYPE html>
<html>
<head>

<style>
#draggable { width: 150px; height: 150px; padding: 0.5em; background:#eee;}
</style>
    
<script type="text/javascript">
$(function() {
$( "#draggable" ).draggable();
});
</script>
</head>
<body>
<div id = "draggable" class = "ui-widget-content">
</div>
</body>
</html>
<?php
}

function loadui() {
    wp_enqueue_script( 'jquery-ui-draggable', false, array( 'jquery' ));
    wp_enqueue_script( 'jquery-ui-droppable', false, array( 'jquery' ));
}

add_action( 'wp_enqueue_scripts', 'loadui' );
add_shortcode( 'jqpage', 'page_jq') ;
?>

I load the short code jqpage in a wordpress page using elementor but dragging animation doesn't work. Can anyone help me?

发布评论

评论列表(0)

  1. 暂无评论