JavaScript JQuery - Loop through each case of a class from a point jquery loop through array,jquery loop through elements,jquery loop

I am creating a self scrolling, auto updating table and need to search through through elements of a class from a certain point. My code currently is this:

var nextScroll;
setInterval(function() {
  if ($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
    $('.seen').removeClass('seen');
    $('html, body').animate({
      scrollTop: 0
    }, 2000);
  } else {
    $('.job-item:not(.seen)').each(function() {
      var visible = $(this).visible();
      if (!visible) {
        nextScroll = $(this).offset().top;
        $(this).addClass("current-scroll");
        return false;
      } else {
        $(this).addClass('seen');
      }
    });
    $('html, body').animate({
      scrollTop: nextScroll
    }, 2000);
  }
}, 7000);

setInterval(function() {
  $.ajax({
    type: 'POST',
    url: 'dashboard-table.php',
    success: function(msg) {
      $("#table-container").html(msg);
      console.log("loaded");
    }
  });
}, 5000);

It basically scrolls down to the next .job-item which is not completely on screen, using the jquery.visible plugin. The issue is that as the page is updated via ajax, the "seen" elements lose the seen class, meaning I would like to store which element was last visible and search over the rows from there.

That is unless anyone has any alternatives which would be greatly appreciated.

FIDDLE: http://jsfiddle.net/yn4wxsej/

Answer:1

How can I get the value of input on click using vanilla javascript? function getvalue() { console.log(this.val); } <input type="text" onclick="getvalue()" value="asdf"></input> &...

How can I get the value of input on click using vanilla javascript? function getvalue() { console.log(this.val); } <input type="text" onclick="getvalue()" value="asdf"></input> &...

  1. value from input javascript
  2. value from input field javascript
  3. value from input angular
  4. value from input jquery
  5. value from input
  6. value from input php
  7. value from input html
  8. value from input field
  9. value from input text
  10. value from input text javascript
  11. value from input type text
  12. value from input radio
  13. value from input java
  14. value from input box
  15. get value from input javascript
  16. get value from input jquery
  17. get value from input
  18. get value from input js
  19. get value from input react
  20. get value from input angular

I tried loading the events dynamically but did not get the output. I brought data using AJAX in the format of var datalist = "2015-09-22":{} $(".responsive-calendar").responsiveCalendar({ events:...

I tried loading the events dynamically but did not get the output. I brought data using AJAX in the format of var datalist = "2015-09-22":{} $(".responsive-calendar").responsiveCalendar({ events:...

I am trying to catch keycode for Dot and Delete but on different events. function validateSomething(eve) { var charCode = (eve.which) ? eve.which : eve.keyCode if (charCode == 46) console.log("...

I am trying to catch keycode for Dot and Delete but on different events. function validateSomething(eve) { var charCode = (eve.which) ? eve.which : eve.keyCode if (charCode == 46) console.log("...

I have an array that I would like to use to populate two different select box's but I'm seeing some weird behavior. Populating the first select works fine but when adding the same list to the second ...

I have an array that I would like to use to populate two different select box's but I'm seeing some weird behavior. Populating the first select works fine but when adding the same list to the second ...

  1. populate select box using javascript
  2. populate select box using ajax
  3. populate select box from database laravel
  4. populate select box jquery
  5. populate select box using jquery
  6. populate select box from database php
  7. populate select box from database using jquery
  8. populate select box using jquery ajax
  9. populate select box dynamically using jquery
  10. populate select box servicenow
  11. populate select box php
  12. populate select box javascript
  13. auto populate select box jquery
  14. jquery populate select box with json data
  15. auto populate select box javascript
  16. populate multi select box using jquery
  17. auto populate select box php
  18. codeigniter populate select box from database
  19. pre-populate select box jquery
  20. populate select option boxes using jquery