0

好的,这是我的问题。

我已经花了大约 10 个小时来尝试在我的网站上放置一个特色内容滑块。尝试任何我能想到的东西。尝试相同滑块的 3 个不同版本。

网址是:http ://www.heartofphoto.com/slidetest/

但无论如何,这就是我目前要做的:

在标题中,我设法得到了这个:

<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script>
<script type='text/javascript'>try{jQuery.noConflict();}catch(e){};</script>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/jquery-ui.min.js'></script>

有或没有“无冲突”部分似乎并没有什么不同。而且我相信在我为 Wordpress 安装了“google libary”插件之后,noconflict 部分就出现了。

这是我在页面中应该显示滑块的脚本:

<script type="text/javascript">

jQuery(document).ready(function(){
    jQuery("#featured").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true);
});
</script>

将那个放在我制作的“featured.php”文件中,或者放在顶部包含的 header.php 文件中没有区别。

所以有人知道我做错了什么吗?

一些编辑:我收到错误 SCRIPT438: Object doesn't support this property or method in slidetest,第 139 行字符 3。这是这一行:

jQuery("#featured").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true);

对于那些想看我的 html 的人。这个版本实际上是使用 php 设置来获取数据:

<div id="featured" >
      <ul class="ui-tabs-nav">
<?php
$postcount = 0;
$featured_query = new WP_Query('cat=29');
while ($featured_query->have_posts()) : $featured_query->the_post();
    get_the_ID();
    $postcount++;
?>
<?php
// get the image filename
$value_feat_img = get_post_custom_values("thumbnail");
if (isset($value_feat_img[0])) { ?>
        <li class="ui-tabs-nav-item ui-tabs-selected" id="nav-fragment-<?php echo $postcount; ?>"><a href="#fragment-<?php echo $postcount; ?>">

        <img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php echo get_post_meta($post->ID, "thumbnail", $single = true); ?>&amp;h=50&amp;w=80&amp;zc=1&amp;q=95" alt="<?php the_title(); ?>" /><span><?php the_title(); ?></span></a><?php } ?>
</li>
          <?php endwhile; ?>

      </ul>

<?php
$postcount = 0;
$featured_query = new WP_Query('cat=29');
while ($featured_query->have_posts()) : $featured_query->the_post();
    get_the_ID();
$postcount++;
?>

    <!-- Content -->
    <div id="fragment-<?php echo $postcount; ?>" class="ui-tabs-panel" style="">
    <?php   // get the image filename
                        $value_img = get_post_custom_values("thumbnail");

if (isset($value_img[0])) { ?>            

        <img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php echo get_post_meta($post->ID, "thumbnail", $single = true); ?>&amp;h=300&amp;w=390&amp;zc=1&amp;q=95" alt="<?php the_title(); ?>" />

        <?php } ?>
         <div class="info" >

            <h2><a href="<?php the_permalink() ?>" ><?php the_title(); ?></a></h2>
            <?php the_excerpt(); ?>
         </div>
    </div>
<?php endwhile; ?>

</div>
4

2 回答 2

0

似乎主题的原始创建者在页脚中以笨拙的方式将旧版本从 jQuery 中删除。

删除它让我的滑块开始工作。

于 2010-11-06T18:56:01.980 回答
0

可能是一个愚蠢的问题,但是,谷歌库调用中的所有这些空间实际上都存在于您的代码中吗?IE

<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2    /jquery.min.js'></script>

我问是因为这不是对 jQuery 的有效引用,所以无论是否存在冲突,都不会定义 jQuery。

于 2010-11-05T18:26:00.973 回答