Basic javascript function

Posted by McDan Garrett on Stack Overflow See other posts from Stack Overflow or by McDan Garrett
Published on 2012-03-29T10:35:52Z Indexed on 2012/03/29 11:30 UTC
Read the original article Hit count: 191

Filed under:
|
|
|
|

I have this function working

<script type="text/javascript">
  $(window).scroll(function() {
    if ($(window).scrollTop() == $(document).height() - $(window).height()) {
      $('div#loadmoreajaxloader').show();
      $.ajax({
        url: "loadmore.php?wall=<?php echo $wall; ?>&lastid=" + $(".postitem:last").attr("id"),
        success: function(html) {
          if (html) {
            $("#postswrapper").append(html);
            $('div#loadmoreajaxloader').hide();
          } else {
            $('div#loadmoreajaxloader').html('<center><font color="white">No more posts to show.</font></center>');
          }
        }
      });
    }
  });
</script>

But I need to have the same stuff happening (on IOS Devices), but instead of it happening when the browser reaches the loadmoreajaxeloader div, I simply need it to happen on an onclick event on a link. Thanks heaps.

Tried to add code but didn't format so here it is http://pastebin.com/p2VUqZff

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript