mercredi 12 juillet 2017

Infinitive scroll is not being triggered on scroll in Laravel 5.4

For reference - the js packages that are being used here are - http://ift.tt/2sRopNT , github - http://ift.tt/2tqZulU .

So the problem is as described in the title - it doesn't seem to trigger on a scroll action(load a new item) when scrolling , unless I use the button method. The only item that is being loaded is the first one(that is loaded when the page loads).

my view

  <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div id="content" class="col-md-10">
                        @foreach($brokenLink as $broken)
                            <div class="item col-lg-12">
                                <h4 class="media-heading">
                                    <small></small>
                                </h4>
                                
                                <hr>
                            </div>
                        @endforeach
                    <button class="button view-more-button"></button>
                            
                </div>

                <p style="clear:both;">&nbsp;</p>
                <img style="display: none" id="loading" src="/images/loading.gif" alt="">
            </div>
        </div>
    </div>

At the bottom of file:

<script src="/js/jquery-3.1.1.min.js"></script>
<script src="/js/infinite-scroll.pkgd.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $('#content').infiniteScroll({
            path: '.pagination__next',
           //button: '.view-more-button', <-- the button method works...
            elementScroll: true,
            append: '.item',
            status:'#loading',
            hideNav: 'ul.pagination',
            prefill: false,
            scrollThreshold: 100,
            debug: true
        });
    });
</script>

My controller

   public function broken_link()
    {
        $brokenLink = BrokenLink::where('user_id', Auth::user()->id)
            ->paginate(1);
        return view('reports/broken_link')->with('brokenLink',$brokenLink);
    }

There are no errors in the console.

I use ubuntu 16.04 , currently newest Chrome Version 59.0.3071.109 (Official Build) (64-bit) - if that helps. I don't think that that could be a browser issue, but also tested on Firefox, also tried using infinite scroll version 2 and jquery v2, same results.... The current used package version is - Infinite Scroll PACKAGED v3.0.0



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2uQwVM6
via IFTTT

Aucun commentaire:

Enregistrer un commentaire