【发布时间】:2012-12-09 20:16:11
【问题描述】:
这是我正在进行的项目。如果您点击 BLOGS on my site,则会显示帖子。现在,如果您单击帖子,将显示该特定帖子的完整视图。但是,由于我在博客文章页面上应用了简单的分页,所以完整的文章视图只能在第一页上工作。以下是分页循环:
jQuery('#Pagination a').live('click', function(e) { //check when pagination link is clicked and stop its action.
e.preventDefault();
var link = jQuery(this).attr('href'); //Get the href attribute
jQuery('#pcontent').fadeOut(500, function() { //fade out the content area
jQuery("#loader").show(); // show the loader animation
}).load(link + ' #pcontent', function() {
jQuery("#loader").hide();
jQuery('#pcontent').fadeIn(500, function() { //load data from the content area from paginator link page that we just get from the top
//hide the loader
});
});
});
整页帖子视图是简单的 jquery show hide(隐藏其他所有内容并显示详细帖子)。
【问题讨论】:
-
你知道你只需要写一次长格式的
jQuery吗?通过将代码包装在(function($) { .... })(jQuery);中,无论noConflict是否被使用,您都可以使用$。 -
不,我没有。我对 jQuery 还很陌生,但谢谢你从现在开始肯定会实现这个方法。
标签: jquery html css pagination