增加加载更多按钮

This commit is contained in:
sw 2015-09-01 16:01:00 +08:00
parent eff6d6cafe
commit c01b71739a
3 changed files with 4 additions and 18 deletions

View File

@ -8,6 +8,7 @@
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;}
.ke-inline-block{display: none;}
</style>
<% user_activities.each do |user_activity|
if user_activities %>
@ -59,4 +60,5 @@
<% end %>
<% end %>
<% end %>
<input type="hidden" value="<%= page%>" id="show_more_activities" />
<input type="hidden" value="<%= page%>"/>
<%= link_to "加载更多",user_activities_path(@user.id),:id => "show_more_activities",:remote => "true"%>

View File

@ -1,19 +1,3 @@
<script type="text/javascript">
var scrollHandler = function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
$.get(
'<%= user_activities_path(@user.id)%>',
{ page: $("#show_more_activities").val(),
type: $("#user_activities_type").val()},
function (data) {
}
);
}
};
$(window).scroll(scrollHandler);
</script>
<input type="hidden" value="<%= @type%>" name="type" id="user_activities_type">
<div class="resources">
<div class="homepageRightBanner">

View File

@ -1,4 +1,4 @@
$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page} )%>");
<% if @user_activities.count < 10%>
$(window).off("scroll", scrollHandler);
$("#show_more_activities").hide();
<% end%>