對於每個相應的圖像的固定鏈接我有這樣的照片庫http://lifelistchase.com/japan-photo-galleryWordPress的+ SmoothDivScroll +彩盒:包括在顏色框
每個圖像上載並插入作爲一個WordPress柱。 縮略圖(the_post_thumbnail)與SmoothDivScroll js一起顯示。當點擊縮略圖時,一個Colorbox出現顯示大圖像(使用php echo catch_that_image()。
我想在大圖像的顏色框中包含一個「X註釋」點擊X註釋(s) )將前往各個圖像的WordPress後的永久 例:http://lifelistchase.com/japan-snow-monkeys-hugging
問:有人告訴我究竟是如何包括顏色框此評論鏈接謝謝!!
圖片庫代碼
$the_query = new WP_Query($args);?>
<?php while ($the_query->have_posts()) : $the_query->the_post();?>
<?php $status = get_post_meta($post->ID, 'status', true); ?><?php $finishdate = get_post_meta($post->ID, 'finishdate', true); ?>
<a href="<?php echo catch_that_image() ?>" rel="favourite" title="<?php the_title(); ?>"><?php the_post_thumbnail(''); ?></a>
<?php endwhile; ?>
Catch_that_image代碼
function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$first_img = "/images/default.jpg";
}
return $first_img;
}
SmoothDivScroll代碼
jQuery(window).load(function(){
// Init Smooth Div Scroll
jQuery("div#makeMeScrollable").smoothDivScroll({ autoScroll: "onmouseout",
autoScrollDirection: "backandforth",
visibleHotSpots: "always",
autoScrollStep: 1,
autoScrollInterval: 38 });
// Init colorbox
jQuery("div#makeMeScrollable a").colorbox({ speed: "500" });
// Pause autoscrolling if the user clicks one of the images
jQuery("div#makeMeScrollable").bind("click", function() {
$(this).smoothDivScroll("stopAutoScroll");
});
// Start autoscrolling again when the user closes
// the colorbox overlay
(document).bind('cbox_closed', function(){
jQuery("div#makeMeScrollable").smoothDivScroll("startAutoScroll");
});
$("#cboxWrapper").bind("contextmenu",function(e){
return false;
});
});
非常感謝您的幫助!我設法從jsfiddle上的工作示例將其實現到我的照片庫中。我希望這將能夠在未來幫助更多的人。 – 2011-12-17 11:05:02