PrettyPhoto和Touchwipe

时间:2013-11-17 20:16:27

标签: php jquery wordpress

我尝试从此处实施已批准的答案:Adding jQuery TouchSwipe to prettyPhoto以完成使用touchwipe与prettyphoto。

该网站使用wordpress,我已正确调用了touchwipe javascript,并在我的page.php中使用脚本标记添加了上面链接中的代码。

出于某种原因,虽然我无法让它发挥作用。

这是来自page.php的代码

<?php
get_header(); 

$no_feat_class = '';
if( !options::logic( 'blog_post' , 'enb_featured' ) || !

has_post_thumbnail( $post -> ID ) ){
    $no_feat_class = ' no_feat ';
}

$post_id = $post -> ID;


/*---------------------*/
$post_format = get_post_format( $post -> ID );
if(!strlen($post_format)){ $post_format = 'standard';}
?>
<script>
$(document).ready(function(){
    function setupBox() {
       $("a[rel^='prettyPhoto']").prettyPhoto({
            social_tools: false,
            theme:'dark_rounded',
            changepicturecallback: function() {
                setupSwipe();
            }
       });
    }
    function setupSwipe() {
       $(".pp_hoverContainer").touchwipe({
        wipeLeft: function() { 
            $.prettyPhoto.changePage('next');
        },  
        wipeRight: function() { 
           $.prettyPhoto.changePage('previous');
    },
       min_move_x: 20,
       min_move_y: 20,
       preventDefaultEvents: true
   });
}
setupBox();
});
</script>
<section id="main">
<div class="main-container">    
    <?php
        while( have_posts () ){ 
            the_post();
            $meta = meta::get_meta( $post -> ID, 'settings' );
            $meta_enb = options::logic( 'blog_post' , 'meta' );   


        } /*EOF while( have_posts () ) */
    ?>
    <?php
        $resizer = new LBPageResizer('page');
        $resizer -> render_frontend();
    ?>
</div>
</section>    

<?php get_footer(); ?>

我做错了吗?

0 个答案:

没有答案