Bonjouuur,
je suis une quiche en Js mais j'ai quand même voulu mettre ce magnifique infinite scroller bref vous l'aurai compris ça ne marche pas :
Voila ce que j'ai fait :
déjà j'ai inclut <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
dans mon header
puis voila le chantier :
La partie intéressante en Js se trouve en bas.
PS : Je précise que le système de pagination fonctionne bien, et que quand je recharge la page avec le script mon <div pagination> disparait donc il reconnait le truc quoi :/
bizarre
Merci beaucoup pour toute aide apporté ^^
<main>
<div id="Parent">
<!-- Left side -->
<div id="Left_Side">
</div>
<!-- Center and main-->
<div id="Center" >
<?php
$db = new PDO('mysql:host=localhost;dbname=article;charset=utf8','root','');
$articleparpages = 1;
$req = 'SELECT id FROM articles';
$ArticlesTotalsReq = $db->prepare($req);
$ArticlesTotalsReq->execute();
$ArticlesTotals = $ArticlesTotalsReq->rowCount();
$pagesTotales = ceil($ArticlesTotals/$articleparpages);
if(isset($_GET['page']) AND !empty($_GET['page']) AND $_GET['page'] > 0 AND $_GET['page'] <= $pagesTotales) {
$_GET['page'] = intval($_GET['page']);
$pageCourante = $_GET['page'];
} else {
$pageCourante = 1;
}
$depart = ($pageCourante-1)*$articleparpages;
$req = 'SELECT img_source,tag,message FROM articles ORDER BY id DESC LIMIT '.$depart.','.$articleparpages;
$result = $db->prepare($req);
$result->execute();
while($article = $result->fetch(PDO::FETCH_ASSOC))
{
?>
<div class="global_post">
<!-- header -->
<div class="header_post">
<img src="https://i.imgur.com/aq39RMA.jpg">
<span>
<b>
Vanestarre
</b>
</span>
</div>
<!-- main -->
<div class="main_post" >
<div class="main_post_img " style="content: url(<?php echo $article['img_source'] ?> )"></div>
<div class="main_post_text" >
<span class="text_span">
<?php echo $article['message']; ?>
</span>
<div class="mini_div_hr"></div>
<span class="tag_span" >
<b>
<?php echo $article['tag']; ?>
</b>
</span>
</div>
</div>
<!-- footer -->
<div class="footer_post">
<div class="emoji_love"> </div>
<span> 0 Love </span>
<div class="emoji_cute"> </div>
<span> 0 cute </span>
<div class="emoji_style"> </div>
<span> 0 style </span>
<div class="emoji_swag"> </div>
<span> 0 swag </span>
</div>
</div>
<?php } ?>
</div> <!-- id='Center' -->
<div id="pagination">
<?php
for($i=1;$i<=$pagesTotales;$i++) {
if($i == $pageCourante) {
echo $i.' ';
} elseif ($i == $pageCourante+1) {
echo '<a href="Site.php?page='.$i.'" class="suivant" >'.$i.'</a> ';
} else {
echo '<a href="Site.php?page='.$i.'" >'.$i.'</a> ';
}
}
?>
</div>
<!--Right Side-->
<div id="Right_Side"> </div>
</div> <!-- div Parent --->
</main>
<script src="https://unpkg.com/@webcreate/infinite-ajax-scroll/dist/infinite-ajax-scroll.min.js"></script>
<script> let ias = new InfiniteAjaxScroll('#Center', {
item: '.global_post',
next: '.suivant',
pagination: '#pagination'
});</script></script>
</body>
</html>