Waterfall flow based on Jquery

WBOY
Release: 2016-07-25 08:48:27
Original
1172 people have browsed it
基于Jquery的瀑布流
  1. AJAX
  2. $page = isset($_GET['page']) ? intval($_GET['page']) : 1;
  3. $size = 20;
  4. try
  5. {
  6. $pdo = new PDO('mysql:host=localhost;dbname=wechatbook', 'root', 'root');
  7. $offset = ($page - 1) * $size;
  8. $sql = "SELECT title FROM wcb_rss_news limit $offset,$size";
  9. $stmt = $pdo->query($sql);
  10. $stmt->setFetchMode(PDO::FETCH_ASSOC);
  11. $list = $stmt->fetchAll();
  12. if (!empty($list))
  13. {
  14. foreach ($list as $row)
  15. {
  16. ?>
  17. }
  18. }
  19. else
  20. {
  21. echo '';
  22. }
  23. }
  24. catch (PDOException $e)
  25. {
  26. }
  27. ?>
  • <script></li> <li> $(function() {</li> <li> var $container = $("#container");</li> <li> $container.imagesLoaded(function() {</li> <li> $container.masonry({</li> <li> itemSelector: '.box',</li> <li> isAnimated: true,</li> <li> columnWidth:200,</li> <li> gutterWidth:200,</li> <li> // isFitWidth:true,//自适应宽度</li> <li> isResizableL:true// 是否可调整大小</li> <li> });</li> <li> });</li> <li> $container.infinitescroll({</li> <li> navSelector: '#next-link',</li> <li> nextSelector: '#next-link a',</li> <li> itemSelector: '.box',</li> <li> animate: true,</li> <li> loading: {</li> <li> msgText: "加载中...",</li> <li> finishedMsg: '没有新数据了...',</li> <li> img: 'http://xialei.test.com/img/loading.gif',</li> <li> selector: '.loading'</li> <li> },</li> <li> localMode: true</li> <li> }, function(newElements) {</li> <li> console.dir(newElements)</li> <li> var $newEle = $(newElements);</li> <li> $newEle.imagesLoaded(function() {</li> <li> $container.masonry('appended', $newEle, true);</li> <li> });</li> <li> });</li> <li> });</li> <li></script>
  • 复制代码


    Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!