Counting and knowing what rows are displayed using jQuery

Ray

I have a table wherein the rows are of different height but are divisible by a certain value. If I scroll down to the middle of the table, is there a way that I will know what rows are displayed and how many are there?

DoubleA

Something like this would work. I haven't had a chance to test it yet. I will try and put a fiddle up in a bit.

I would use this with a throttle on the scroll trigger if you are going to implement it in live, otherwise it would be very intensive for your page to handle.

$(window).on('scroll', function () {
    var top = $(window).scrollTop();
    var rows = $('.my-table tr');
    var range = 100;

    rows.each(function () {
        var offsetTop = $(this).offset().top;
        if (offsetTop - top >= 0 && offsetTop - top <= range) {
            console.log("This is the row at the top of the page");
    });


});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Counting and knowing what rows are displayed using jQuery

From Dev

Counting up using jquery

From Dev

Counting duplicate rows using Excel

From Dev

counting no of specific rows in a table using jquery(.each() function) also using .attr() function

From Dev

What to count when counting all rows MySQL

From Dev

What to count when counting all rows MySQL

From Dev

Knowing what you should be using in WebMatrix

From Dev

Counting rows in datagridview using c#

From Dev

Counting number of rows using token in views

From Dev

Counting rows from a GROUP BY query using an index

From Dev

Targeting instances of JQuery UI Accordion without knowing what they are

From Dev

Counting HTML string elements using Jquery

From Dev

Counting inputs with values on change using jquery

From Dev

Counting inputs with values on change using jquery

From Dev

Assigning properties using RTTI without knowing what type the property is

From Dev

Getting id/class knowing src of an image using jQuery

From Dev

Counting amount of db rows of a user using timestamp - Best approach?

From Dev

Counting Distinct rows based on column using SQL Server

From Dev

Counting filled rows issue in datagridview using binding source in C#

From Dev

Retrieving value of displayed div using jquery

From Dev

Retrieving value of displayed div using jquery

From Dev

Tried to load table dynamically using AJAX but rows not displayed

From Dev

Counting rows with esqueleto

From Dev

Counting and aggregating by two rows

From Dev

Counting Rows for Grouping and Paging

From Dev

Pandas Counting Unique Rows

From Dev

Counting rows from table

From Dev

counting rows and joining tables

From Dev

Counting Number of Rows

Related Related

HotTag

Archive