堆栈。
我们在一个网站上工作:http://rodneycrowell.wpengine.com
这是一个单页面滚动,有相当多的窗口小部件。主页上的第一个小部件是使用jQuery UI Tabs设置的。我们通过functions.php文件将样式和jQuery ui排入队列,如下所示:
function ahso_scripts() {
wp_register_script( 'jquery-easing', CHILD_URL . '/library/js/jquery.easing.1.3.js', array('jquery'), '1.3', TRUE );
wp_register_script( 'jquery-smoothness', CHILD_URL.'/library/js/jquery.smoothscroller.js', array('jquery-easing'), '1.0', TRUE );
wp_register_style( 'jquery-ui-custom', CHILD_URL.'/library/css/jquery-ui-1.9.0.custom.css', '', '1.9.0', 'all' );
// only on the home page
if ( is_front_page() ) {
wp_enqueue_script( 'jquery-easing' );
wp_enqueue_script( 'jquery-smoothness' );
// jquery-ui-tabs
wp_enqueue_style( 'jquery-ui-custom' );
wp_enqueue_script( 'jquery-ui-tabs' );
}
}
add_action( 'wp_enqueue_scripts', 'ahso_scripts' );在page-home.php模板上,我们像这样实例化了jQuery Ui Tabs:
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function() {
jQuery("#tabs").tabs();
});
//]]>
</script>
<!--[if lt IE 9]-->
<script type="text/javascript">
//<![CDATA[
jQuery(function() {
jQuery("#tabs").tabs("option", "disabled", false);
});
//]]>
</script>
<!--[endif]-->这个标记有点有趣,因为我一直在尝试一些东西,没有传递'$‘作为别名,使用(文档).ready(),疑难解答。
由于某些原因,选项卡不能实例化或工作,我们在控制台中没有收到选项卡的错误,诚然,在一些小部件中发生了很多事情,但这个问题在我们添加任何东西之前很久就出现了,
真正让我感到悲哀的是,我们已经在另一个网站上用几乎相同的方式做了这件事,而且它起作用了。http://granthammond.com
如果你往下看侧边栏的底部,你会看到一些选项卡,唯一的巨大区别是它们是由一个短码输出的,而不是这些,它们在页面模板中回显出来。
再次感谢stack。
发布于 2012-10-24 00:22:02
jQuery UI选项卡的javascript部分正在工作。如果您查看源代码并单击不同的选项卡标题,就会发现添加了正确的css类。但是,jQuery UI stylesheet =]中不包含必要的选项卡样式
发布于 2012-10-16 04:03:55
当然,你有一个静态的头版头条?
试一试
if ( is_home() OR is_front_page() )
{
// ...而不是。
https://stackoverflow.com/questions/12903683
复制相似问题