Chnge php (w ajax) load image to link to post
-
I’m modifying a Portfolio theme called Contrast.Currently thumbnails link to a full image (BG_image). How would I change the following code so that it linked instead to the post associated with that image (i.e. in which the image is posted)?
Many thanks!
<?php if (have_posts()) { ?>
<script type=”text/javascript”>
$(document).ready(function() {
$(‘.nav.portfolio .navMask ul.navContent, .menu, .footer’).hover(function() {
$(‘.nav.portfolio .navMask ul.navContent’).animate({right: ‘0px’}, {queue:false, duration: 500});
$(‘.menu, .footer’).animate({opacity: ‘1’}, {queue:false, duration: 500});
},
function(){
$(‘.nav.portfolio .navMask ul.navContent’).animate({right: ‘-200px’}, {queue:false, duration: 300});
$(‘.menu, .footer’).animate({opacity: ‘0.1’}, {queue:false, duration: 300});
});$(‘.nav.portfolio .navMask ul.navContent li p.image a’).click(function() {
$(‘.loading’).show();
$.ajax({
type: ‘GET’,
url: ‘<?php bloginfo(‘template_url’); ?>/load_background.php’,
data: ‘BG_image=’ + $(this).attr(‘rel’),
success: function(html) {
$(‘#background’).html(html);$(‘#background img’).load(function() {
$(this).css({
top: ($(window).height() – $(this).height()) / 2,
display: ‘block’
});$(‘.loading’).hide();
});
}
});
});$(‘.nav.portfolio .navMask ul.navContent li p.image a:eq(0)’).click();
});
</script>
<?php } ?>
- The topic ‘Chnge php (w ajax) load image to link to post’ is closed to new replies.