jQuery selectmenu WordPress [英] jQuery selectmenu wordpress

查看:97
本文介绍了jQuery selectmenu WordPress的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将网站从普通的php迁移到wordpress,目前他们将jquery-selectmenu插件用于其选择菜单.

I am moving a site from normal php to wordpress and currently they use jquery-selectmenu plugin for their select menus.

我试图将脚本排入wordpress头部,但是没有运气.

I have tried to enqueu the script in wordpress head with no luck.

上一个站点中的脚本如下所示.

The scripts from the previous site look as follows.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<link rel="stylesheet" href="<?php echo $siteurl; ?>css/custom-theme/jquery-ui-1.8.1.custom.css" type="text/css" /> 
<script type="text/javascript" src="<?php echo $siteurl; ?>js/select-menu.js"></script>
<script type="text/javascript" src="<?php echo $siteurl; ?>js/init.js"></script>

init.js 只需调用该函数即可工作

init.js simply calls the function and works

$(function(){
    $('select#speedC').selectmenu({style:'dropdown'});
});

现在在Wordpress中,我在脑海中添加了以下内容.

Now in Wordpress i added the following to my head.

<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'template_url' ); ?>/custom-theme/jquery-ui-1.8.1.custom.css" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />

<?php wp_enqueue_script( 'jquery-ui-core' ); ?>
<?php wp_enqueue_script( 'swfobject' ); ?>
<?php wp_enqueue_script( 'ui-core-select', get_bloginfo('template_directory') . '/js/select-menu.js' ); ?>
<?php wp_enqueue_script( 'jquery-pajinate', get_bloginfo('template_directory') . '/js/jquery.pajinate.js' ); ?>
<?php wp_enqueue_script( 'jquery-ui', get_bloginfo('template_directory') . '/js/jquery-ui.1.7.2.min.js' ); ?>

还有我页面中的脚本

<script type="text/javascript">
    $j=jQuery.noConflict();

    // Use jQuery via $j(...)
    $j(document).ready(function(){
        $j('select#speedC').selectmenu({style:'dropdown'});
    });
</script>

有什么想法为什么不开始?

Any ideas why it is not initiating?

推荐答案

进行了更多研究后,我发现现有库当前未保持最新状态,并且无法与jQuery很好地兼容.

After doing some more research I found that the existing library is not currently kept up to date and not playing well with jQuery.

从现在开始,请参考 jQuery.ui.selectmenu.js

这篇关于jQuery selectmenu WordPress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆