Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Vincent DeCapite 64 posts 83 karma points
    May 16, 2011 @ 14:17
    Vincent DeCapite
    0

    Repeatable Custom Content Plugin V2 Issues

    Hi There,

    I am hoping I can get some guidiance or some help with this to point me in the right direction. We are using this plugin on our website so that it can list documents that are attached to a certain item. Problem is, now we want to change the code around so that each document has its own line instead of 2 documents sharing one line. Here is the code that is working so far with 2 documents on one line:

    $(function(){
     /* Images */
     $('a.thumb').click(function(){
      $('#productImage').attr('src', this.href);
      return false;
     });
     
     if ($('#product .productInfo ul').length == 1 && $('#product .productInfo:has(ul:empty)').length > 0){
      $('#product .productInfo').hide();
     }
     else {
      var documents = $('#product .productInfo li');
      var table = $('<table class="documents" />');
      
      for (var x=0; x<documents.length; x+=2){
       var row = $('<tr />');
       row.append('<td>'+ documents.eq(x).html() +'</td>');
       row.append('<td>'+ (( x +1 < documents.length) ? documents.eq(x+1).html() : '') +'</td>');
       table.append(row);
      }
      
      table.find('a').prepend('<img src="/elements/spacer.gif" />');
      table.find('tr:odd').addClass('even');  
      $('#product .productInfo ul').replaceWith(table);
     }
     

    To change it so that each document has its own line i changed the following code:

    row.append('<tr>'+ documents.eq(x).html() +'</tr>');
       row.append('<tr>'+ (( x +1 < documents.length) ? documents.eq(x+1).html() : '') +'</tr>');

    The problem that I have with this, is that the ID attributes are still Even Even Odd Odd so that the CSS is not working properly. Anyway someone can help me change the property so that it goes as Even Odd Even Odd so the css works?

    Any help would be greatly appreciated.

    THANKS!

  • Sean Mooney 131 posts 158 karma points c-trib
    May 16, 2011 @ 15:47
    Sean Mooney
    0

    &

    use this:

    for (var x=0; xgt;');
       row.append(''+ documents.eq(x).html() +'');
       table.append(row);
    }

     

    This is more of a jQuery/javascript issue, not related to Repeatable Custom Content

     

    Or you could just remove the jQuery and use the UL structure that is being output.

    All the javascript is doing is transforming a UL to a two column table.

Please Sign in or register to post replies

Write your reply to:

Draft