2

I added JQuery Pagination to my online portfolio. Here is the link:

http://joshrachner.com/experience

It seems to work fine in Chrome and Firefox, but only the first item gets loaded in IE.

Can someone take a look?

Thanks.

EDIT

Here is the code JQuery code:

    <script type="text/javascript" charset="utf-8">
            var pagination_options = {
              //num_edge_entries: 5,
              //num_display_entries: 5,
              callback: pageselectCallback,
              items_per_page:5
            }

            function pageselectCallback(page_index, jq){
              var items_per_page = pagination_options.items_per_page;
              var offset = page_index * items_per_page;
              var new_content = $('#hiddenresult div.post').slice(offset, offset + items_per_page).clone();
              $('#Searchresult').empty().append(new_content);
              return false;
            }

            /**
             * Initialisation function for pagination
             */
            function initPagination() {
              var num_entries = $('#hiddenresult div.post').length;
              // Create pagination element
              $("#Pagination").pagination(num_entries, pagination_options);
            }

            // When document is ready, initialize pagination
            $(document).ready(function(){
              initPagination();
            });
    </script>
Justin Johnson
  • 30,978
  • 7
  • 65
  • 89
Josh
  • 3,601
  • 14
  • 50
  • 71
  • I am not seeing the problem in IE 8. All three pages are coming up fine with all of the items on each page. – Amy Anuszewski Apr 18 '11 at 19:36
  • It's not working in IE7. Working fine in IE8/9. Can you provide some code what you're doing? – Naveed Ahmad Apr 18 '11 at 19:38
  • The piece where I'm using the slice() method is something I grabbed off the web. The pagination didn't seem to work, so I used someone else's code for that. Maybe that is what is breaking? Seems as though the variable 'new_content' just isn't getting populated with all the elements. – Josh Apr 18 '11 at 19:46

1 Answers1

0

So, I think I figured it out. It appears that my HTML was wrong. It should have been:

<div id="hiddenresult" style="display:none;"> 
  <div class="post">Text</div>
  <div class="post">Text</div>
  <div class="post">Text</div>
</div> 

As opposed to this:

<div id="hiddenresult" style="display:none;"> 
  <div class="post">Text</div>
</div>
<div id="hiddenresult" style="display:none;"> 
  <div class="post">Text</div>
</div>
<div id="hiddenresult" style="display:none;"> 
  <div class="post">Text</div>
</div>

Either way, it appears that the JQuery Pagination plugin documentation doesn't work just right. The JQuery code in this post seems to work just fine now for all the browsers. Here is another post that talks about it:

jQuery Pagination Plugin

Could someone check on IE 8/9 for me? I would really appreciate it.

joshrachner.com/experience

Community
  • 1
  • 1
Josh
  • 3,601
  • 14
  • 50
  • 71