Making WordPress.org

Ticket #470: template-events.diff

File template-events.diff, 697 bytes (added by utkarshd_42, 12 years ago)

Diff for template-events.php

Line 
10a1,29
2> <script>
3> var flag = 0;
4> var offset = 0;
5> var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
6> function async_infinite_load() {
7> jQuery.post (
8> ajaxurl,
9> {
10> 'action': 'infinite_scroll',
11> 'off' : offset,
12> },
13> function( response ) {
14> jQuery("#ofe_events ul").append(response);
15> flag = 0;
16> offset = offset + 1;
17> }
18> );
19>
20> }
21>
22> jQuery(window).scroll( function() {
23>
24> if( jQuery(window).scrollTop() + jQuery(window).height() > ( jQuery('#ofe_events').height() + jQuery('#ofe_events').offset().top -10 ) && !flag ) {
25> flag = flag + 1;
26> async_infinite_load();
27> }
28> } );
29>
30> </script>