使用滚动加载器回退

时间:2014-06-22 17:04:16

标签: php jquery html load progressive-enhancement

你在这里的神奇社区,在我的第一个问题上。

我从头开始创建一个博客,并且已经知道我可以使用jquery和PHP在滚动事件上加载内容(以保存一次加载所有内容)。对于那些不知道如何或这是什么的人,你可以在这里找到一个教程链接:

http://www.9lessons.info/2009/07/load-data-while-scroll-with-jquery-php.html

但是,此方法依赖于javascript请求。在良好实践的名义和1-2%仍然加载雅虎主页禁用java脚本的人。这可能导致用户仅加载几个帖子,或加载整组帖子。我想找到最好的渐进式解决方法,让我能够:

  1. 如果启用了Javascript(正常使用上述JQ / PHP滚动方法加载内容)
  2. 如果Javascript被禁用(Grayskull Forbid!?)会自动回退到更多html / css依赖方法,而不必单独设计它。
  3. 相当复杂的问题,我希望这是有道理的。如果我沿着正确的方向思考,html / css后备可能是用单独的页面和页面按钮来分解内容,但我不确定两者如何一起翻译,例如,我是什么JQ / PHP滚动方法的设计似乎在一个加载页面中,其中html替代似乎在分离的页面上。

    我可以使用一些建议。

1 个答案:

答案 0 :(得分:0)

给你一个想法:伪代码:

<noscript>
    <!-- Server-side language generated pagination -->
    <a href="1.html" class="active">1</a>
    <a href="2.html">2</a>
    <a href="3.html">3</a>
</noscript>    

<content>
   <article>
   <article>
   <article>
   <article>
   <!-- JS pushes new content on scroll with AJAX, otherwise...-->
</content>

<noscript>
    <a href="1.html" class="active">1</a>
    <a href="2.html">2</a>
    <a href="3.html">3</a>
</noscript>