php - How to hide the previously loaded ajax content, using toggle function -


this how pagination script works

1: on page load - ajax load content automatically (done)

2: onclick load_more btn(using toggle show) - load , show more content (done)

3: onclick load_more btn(using toogle hide) - hide whatever loaded @ set 2 (how implement this)

<div class="resultsblock">      <div class="results"></div>      <div class="clear:left;"></div>     <button class="load_more" id="load_more_button"></button>    <div class="animation_image" style="display:block;">loading...</div>  </div>  <script>  jquery(document).ready(function() {       var url = "http://www.abc.com";      var track_click = 1; //track user click on "load more" button      var total_pages = <?php echo $this->totalpages(); ?>;     console.log(total_pages);     // default load      jquery('.results').load(url, {'p':track_click}, function()      {       jquery('.animation_image').hide();      if(total_pages==1) {  jquery(".load_more").hide();  } else { jquery(".load_more").show();    }      } );       jquery(".load_more").toggle(function(){      jquery(this).hide();                           jquery('.animation_image').show();              console.log(track_click);                 // ajax load first load             jquery.post(url,{'p': track_click}, function(data) {                             jquery(".load_more").show();                                  jquery(".results").append(data);                                jquery('.animation_image').hide();                               });                  // how hide elements loaded ajax       },function(){console.log('hide previous load')});   --- step 3       });  // may not affect toggle. waiting ajax finish , perform more..  jquery(document).ajaxcomplete(function(){ if(jquery('.prod').length != 0) {     jquery(".prod").hover(function(){     jquery(this).find(".prod_title").hide();     jquery(this).find(".prod_desc").fadein(); },function(){         jquery(this).find(".prod_desc").fadeout();   jquery(this).find(".prod_title_wrap").show(); jquery(this).find(".prod_title").show();      }); }  });    </script> 

i don't want hide first content showing on page load in starting. how can achieve please suggest something. thank you

i think, do:

... jquery(".load_more").show();                    jquery(".results").fadeout(function() {     jquery(".results")         .empty()         .append(data)         .fadein()     ; }); ... 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -