簡體   English   中英

jscroll jQuery和延遲加載無法一起工作

[英]jscroll jQuery and lazy loading together can't work

我的Web應用程序網格布局圖像已顯示,但jscroll和延遲加載無法一起使用; 僅jscroll插件有效。

請指導我如何實施。 我是jQuery的初學者。 如何修復多個jQuery沖突?

<script type="text/javascript">
    $(document).ready(function(){   
        $('.scroll').jscroll({  
            loadingHtml: '<img src="images/loader_lazy.gif" alt="Loading" /> Loading...',
            autoTriggerUntil: 3
        });
    });
</script>

============== function.php ================================= =

class modLazyloading extends constructClass {

    var $fileToLoad = '/engine/modules/lazyloading/test.php';
    var $iterations = 3;

    public function __construct($url='') {
        parent::__construct();
        if ($url!='') {$this->fileToLoad = $url;}
        if ($_GET['operation']==''){ $this->index(); }
        if ($_GET['operation']=='page'){ 
            $this->loadPage(); 
            $this->loadPageScript();
        }
    }

    public function index(){
        //$this->pageController->warstwaA();
        $this->view();
        //$this->pageController->warstwaB();
    }

    public function view(){
        echo "<div class='scroll'><a href='$this->fileToLoad?operation=page&id=$news_id&typ=$typ'>next page</a></div>
        <script type='text/javascript' src='/engine/lib/jscroll-master/jquery.jscroll.js'></script>
        <script>$('.scroll').jscroll({ autoTriggerUntil: $this->iterations });</script>";
    }

    public function loadPage(){
        echo 'loadpage P';
    }

    public function loadPageScript(){
        echo "<div class='scroll'><h3>Page 1</h3><p>Content here...</p><a href='$this->fileToLoad?operation=page'>next page</a></div>";
    }

}

==================== test.php ============================ ======

require_once 'modules/lazyloading/functions.php';

class lazyloading extends modLazyloading {

    public function loadPage() {
        echo 'testowa strona załadowana';
    }

    public function index(){
        $this->pageController->warstwaA();
        parent::index();
        $this->pageController->warstwaB();
    }

}

global $modLazyloading; $modLazyloading = new lazyloading();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM