jquery和Live Link中的样式



我在尝试使用WordPress和实时链接时遇到了一些问题。

让我解释一下:

我在名为的类别中有这个链接

<a href="p?32" id="control">event 32</a>

事件32由以下代码管理:

  $.ajaxSetup({cache:false});

  $('#control').click(function(){
    var post_id = $(this).attr('href')
    $('#calendar').animate({top:'-99em'},400,
      function(){
        $(this).hide();
        $('#theEvent').fadeIn(400);
        $('#theEvent').html('<div class="loading"></div>');
        $('#theEvent').load(post_id);
      });
    return false;
  });

这很完美,这首单曲的内容如下:

a这是单曲。hp:

<div class="space"></div>
<div class="clearfix">
    <?php the_post(); ?>
    <div class="descritpion">
        <h2><?php the_title(); ?></h2>
        <span><?php the_author(); ?></span>
        <?php the_content(); ?>
        <div class="center">
     <a href=# id="prev">Prev</a>
     <a href=# id="next">Next</a>
   </div>
 </div>
 <div class="gallery" >
  <a href="/#fourth" id="close" class="close">X</a>
  <div id="slideShow">
    <?php the_gallery(); ?>
  </div>

函数the_gallery()只是一个带有链接的图像循环:<a rel="fancybox"><img/></a>

编辑:06.09.12

图库功能与附件插件配合使用

function the_gallery() {
    $attachments = attachments_get_attachments();
    $total_attachments = count($attachments);
    if( $total_attachments > 0 )
    {
        for ($i=0; $i < $total_attachments; $i++)
        {
            $url =  wp_get_attachment_image( $attachments[$i]['id'],
                'bullet-event');
            $lrgurl = wp_get_attachment_image_src( $attachments[$i]['id'], 'large' );


            echo '
            <a href="'.$lrgurl[0].'"
            rel="#overlay" title="'.$attachments[$i]['title'].'">
            ' . $url . '
            </a> ';

        }
    }
}

php中的jquery是:

var wrapEveryN = function(n, elements, wrapper) {
    for (var i=0; i< elements.length; i+=n) {
        elements.slice(i,i+n).wrapAll(wrapper);
    }
}
wrapEveryN( 12, $("#slideShow a"), '<div></div>' );
$('#slideShow').cycle({
    fx:     'scrollLeft'
});

问题来了,在单曲中,我必须管理一个图片库(循环)一个粉丝盒和风格。。。唯一正确显示的是样式,但我不知道js为什么不起作用:

我的所有代码和插件都在plugins.php&main.php

我假设您的js代码位于就绪块中,因此不会执行2次。

举个例子:

$('#theEvent').load(post_id, function(){
  wrapEveryN( 12, $("#slideShow a"), '<div></div>' );
  $('#slideShow').cycle({
    fx: 'scrollLeft';
  });
});

PS:您应该只加载页面片段

最新更新