无限滚动手动触发器
只是似乎没有工作… :-(已经看到更多的投诉,但我找不到答案。
问题:无限滚动有效但不是手动触发。 当我点击链接时,没有任何反应。 萤火虫给
无限滚动
我的代码:
<?php echo (''); ?> query('paged='.$paged.'&cat=5&showposts=3&meta_key=video_video&orderby=meta_value&order=ASC' . $post->ID); while ($wp_query->have_posts()) : $wp_query->the_post(); ?> ID, 'video_video', true) ) : ?> - 290, "w" => 380, "zc" => 1, "q" =>100); //echo get('video_video'); echo ('With: '); echo get('participant_first_name'); echo (' '); echo get('participant_last_name'); echo ('
');?> ID, 'video_video', true) ) { ?> max_num_pages > 1) : ?> There are no interviews at the moment
我的剧本:
jQuery('ul#infinite').infinitescroll({ navSelector : "#next", // selector for the paged navigation (it will be hidden) nextSelector : "#next a", // selector for the NEXT link (to page 2) itemSelector : "ul#infinite li", // selector for all items you'll retrieve errorCallback: function() { // fade out the error message after 2 seconds $('#infscr-loading').animate({opacity: 0.8},2000).fadeOut('normal'); }, loading : { msgText: "Loading the next year of Grantees...", finishedMsg: "You've reached the end of the Interviews." }, }); //kill scroll binding jQuery(window).unbind('.infscr'); //setTimeout("jQuery('#next').slideDown();", 1000); //hook up the manual click guy. jQuery('#next a').click(function(){ jQuery('#next a').infinitescroll('retrieve.infscr'); return false; });
也试过了
jQuery(document).trigger('retrieve.infscr');
代替
jQuery('#next a').infinitescroll('retrieve.infscr');
但没有运气。
然后Firebug说trigger(retrieve.infscr) called incorrectly
Pfoe,发现它……万岁的好文档(不带这个插件!)
这个:
jQuery('#next a').click(function(){ jQuery('#next a').infinitescroll('retrieve.infscr'); return false; });
应该:
jQuery('#next a').click(function(){ jQuery('ul#infinite').infinitescroll('retrieve'); return false; });
最大的问题是.infscr不应该在那里..希望它可以帮助别人..
类似文档的解决方案:
jQuery("#clickable_element").click(function(){ jQuery('#main_content_container').infinitescroll('retrieve'); return false; });
注意:
如果您正在使用砌体或同位素以使其工作,则可能必须添加手动触发器行为 。 只需在infinitescroll之后包含manual-trigger.js
并通过传递行为传递behavior: 'twitter'
在调用插件时。
我做了以下调整,以确保第一次点击后导航链接出现:
jQuery("#clickable_element").click(function(){ jQuery('#main_content_container').infinitescroll('retrieve'); jQuery('#pagination').show(); return false; });
也许…… $(’#next a’)。click(); ?