G
G
gladislav992020-08-14 16:25:35
JavaScript
gladislav99, 2020-08-14 16:25:35

JavaScript in google chrome is not working correctly, what's the problem?

When you click on the "show more" button in google chrome, the products rise above the button and do not fall down with the button. In other browsers everything is ok
Here is the download code

var my_repeater_total = <?php echo $total; ?>;
            var total_pages = Math.floor(parseInt(my_repeater_total / 6));
            var my_repeater_field_post_id = <?php echo $post->ID; ?>;
            var my_repeater_field_offset = <?php echo $number; ?>;
            var my_repeater_field_nonce = '<?php echo wp_create_nonce('my_repeater_field_nonce'); ?>';
            var my_repeater_ajax_url = '<?php echo admin_url('admin-ajax.php'); ?>';
            var my_repeater_more = true;
            function my_repeater_show_more() {
                    // make ajax request
                    jQuery.post(
                      my_repeater_ajax_url, {
                        'action': 'my_repeater_show_more',
                        'post_id': my_repeater_field_post_id,
                        'offset': my_repeater_field_offset,
                        'nonce': my_repeater_field_nonce
                      },
                      function (json) {
                        res = parseInt(my_repeater_total - my_repeater_field_offset);
                        current_page = Math.floor(parseInt(res / 6));
                        jQuery('#my-repeater-show-more-link').text('Показать еще ('+ current_page + ')');
                        jQuery('.products_ajax').append(json['content']);
                        my_repeater_field_offset = json['offset'];
                        if (!json['more']) {
                          jQuery('#my-repeater-show-more-link').css('display', 'none');
                        }
                      },
                      'json'
                      );
                  }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question