i've got little problem infinite scroll js.
i using 1 on pre-made pagination working : http://infiniteajaxscroll.com/docs/getting-started.html
here js of :
var ias = jquery.ias({ container: '.posts', item: '.post', pagination: '.pagination', next: '.next a', delay: 1250 }); ias.extension(new iasspinnerextension()); // add text when there no more pages left load ias.extension(new iasnoneleftextension({text: "you reached end"}));
and here pagination (just in case) :
sql query : // pagination $totalproductcat = $dbh->query("select count(*) total products p left join subcategories s on s.id = p.subcategorieid left join categories c on c.id = s.categorieid s.categorieid = ".$_get['cat']." ")->fetchobject()->total; $limit = $_get['limit'] ?? 0; $sql = " select s.id, p.id as`productid`, p.name `productname`, p.price, p.image `productimage`, p.description, p.eval products p left join subcategories s on s.id = p.subcategorieid s.categorieid = :catid limit ".$limit.' , '.max_cat; $resultcat = $dbh->prepare($sql); $resultcat->execute(['catid' => $_get['cat']]);
pagination code :
<?php // display pagination echo '<nav>'; echo '<ul class="pagination">'; // left arrow echo '<li class="page-item"><a class="page-link" href="'.($limit == 0 ? '#" onclick="return false"' : '?page=product&cat='.$_get['cat'].'&limit='.($limit - max_cat)).'">«</a></li>'; // numbers (1,2,3...) for($i = 0; $i < $totalproductcat / max_cat; $i++) { echo '<li class="page-item ' .($limit == $i * max_cat ? 'active' : '').'"><a class="page-link" href="?page=product&cat='.$_get['cat'].'&limit='.$i * max_cat.'">'.($i+1).'</a></li>'; } // right arrow echo '<li class="page-item next"><a class="page-link" href="'.($limit + max_cat >=$totalproductcat ? '#" onclick="return false"' : '?page=product&cat='.$_get['cat'].'&limit='.($limit + max_cat)).'">»</a></li>'; echo '</ul></nav>'; ?> <?php endif;?>
it working boostrap pagination template (arrows & numbers).
the problem that, once implement infinite scroll plugin, (jquery-ias.min.js , can download free on website), datas once loaded on page, restart loading , infinite...
i don't message :
// add text when there no more pages left load ias.extension(new iasnoneleftextension({text: "you reached end"}));
should implement async: false?
any please.
Comments
Post a Comment