Jump to content

Why distance between link and grid of images is decreased by any click ?


mstdmstd

Recommended Posts

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.