mstdmstd Posted January 18, 2022 Share Posted January 18, 2022 Hello, With jquery I have “Load more” link which is implemented with code like : <div id="div_nominated_photos_container" style="margin: 10px !important; WWborder: 3px dotted red !important; "> </div> <div style="margin: 10px !important; " id="div_add_new_photos"> <a onclick="javascript:loadNominatedPhotos(true)" class="nomination-new__btn-more " style="cursor: pointer;"> <svg class="nomination-new__arr-down"> <use xlink:href="/img/sprite.svg#arr-down"></use> </svg> Ещё фото </a> </div> function loadNominatedPhotos(load_next_page) { if (load_next_page) { current_page++ } var current_nomination_id = <?php echo e($currentNomination->id ?? ''); ?> $.ajax({ type: "GET", dataType: "json", url: '/get_nominated_photos/' + current_nomination_id + "/" + current_page, // public function get_nominated_photos($nomination_id, $current_page= 1) success: function (response) { if (current_page === 1) { $("#div_nominated_photos_container").html(response.html); } if (current_page > 1) { $(".main_gallery__block:last").after(response.html); } if (response.rows_uploaded_count >= response.nominated_photos_total_count) { $("#div_add_new_photos").css('display', 'none'); } else { $("#div_add_new_photos").css('display', 'block'); // $($(".para")[1]).css({"color":"yellow"}); $("#div_add_new_photos").css('margin-top', '10px !important;'); //padding-top: 10px !important; } }, error: function (error) { console.error(error) } }); } adding more content work ok. but I have a problem that clicking on “Ещё фото” link distance between this link and grid of images is decreased by any click :Printscreen Live at:Live link When 15 rows are loaded then on “Ещё фото” link is hidden at all, as all data are retrieved. I tried to set margins in content div design or programatically but failed. How that can be fixed ? Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.