我有一个真正的问题。我正在为WordPress创建一个主题。在一个类中我有一个大尺寸的缩略图。我想做一些像这样的事情:
当用户点击我的课程时,我想将该课程的图片放入图片标签中。 有点像这样:
$("#big-gal-img").attr("src", $(this).children('.mgallery-image-big').val());
这是我的完整代码:
<?php get_header();?>
<div id="big-gal-div">
<div id="back-gal">
</div>
<img id="big-gal-img">
</div>
<center>
<div id="mgallery">
<div class="mGallery-Box">
<?php query_posts ('');?>
<?php if(have_posts()) :?>
<?php while(have_posts()) : the_post();?>
<div id="mone-in-gallery">
<div class="mgallery-title">
<a >
<span><?php the_title(); ?></span>
</a>
</div>
<div class="mgallery-image" title="<?php the_title(); ?>"><a>
<?php the_post_thumbnail();?>
</a>
</div>
<div class="mgallery-image-big"><a>
<img class="mgallery-image-big" src="<?php the_post_thumbnail( full );?>">
</a>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query();?>
</div>
</div>
</center>
<script>
$(document).ready(function(){
$('.mgallery-image-big').hide();
$('#big-gal-div').hide();
$('#big-gal-img').click(function(){
$('#big-gal-div').hide();
});
$('#mone-in-gallery').click(function(){
var image_url = $('#mgallery-image-big').html();
$("#big-gal-img").attr("src", $(this).children('.mgallery-image-big').val());
$('#big-gal-div').show();
});
});
</script>
<?php get_footer();?>