'Jquery - Featured Content Slider not working
Okay, so here is my problem.
I've been spending probably about 10 hours to try to put a Featured Content Slider on my website. Trying with anything I can come up with. Trying probably 3 different versions of the same slider.
The URL is: http://www.heartofphoto.com/slidetest/
But anyways, here is what I currently have going:
In the header I've managed to get this:
<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>
Having or not having the "noconflict" part doesn't really seem to make a difference. And I believe that the noconflict part came in after I installed the "google libary" plugin for Wordpress.
And here is the script that I have inside the page that should display the slider:
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#featured").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true);
});
</script>
Having that one in the "featured.php" file I made, or having it in the header.php file that is included at the top makes no difference.
So anyone have a clue what I am doing wrong?
Some edits: I get error SCRIPT438: Object doesn't support this property or method in slidetest, line 139 character 3. Which is this line:
jQuery("#featured").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true);
And for those of you that wanted to see my html. This version is actually using a php setup to get the data:
<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); ?>&h=50&w=80&zc=1&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); ?>&h=300&w=390&zc=1&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>
Solution 1:[1]
May be a stupid question, but, are all those spaces in the google library call actually there in your code? IE
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2 /jquery.min.js'></script>
I ask because that's not a valid reference to jQuery so it doesn't matter if there's a conflict or not, jQuery won't be defined.
Solution 2:[2]
Seems the original creator of the theme had put an old version off jQuery in a clumsy way in the footer.
Removing that got my slider to start working.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jeremy |
| Solution 2 | Alexander |
