Skip to content

wont work if we rearrange items after page load #13

@Hretic

Description

@Hretic

i'm using this plugin to know which item in my page has been seen ... something like this

$('li.not_seen').bind('inview', function (event, visible, topOrBottomOrBoth) {
  if (visible == true) {
       $(this).removeClass('not_seen');
       console.log($(this).attr('id'));
  }
});

it works great but here is the problem

i have a sort plugin which rearranges the items based on their attributes , so for example if i click on sort by date items with bigger or smaller date would come to top of the page without any scrolling ... here is the problem , now when i scroll none of the items would trigger inview and code wont work anymore

i've tried to re-run the plugin code with each sort

    $(document).on('click' , '.sort' , function(){
            $('li.not_seen').bind('inview', function (event, visible, topOrBottomOrBoth) {
          if (visible == true) {

               $(this).removeClass('not_seen');
               console.log($(this).attr('id'));
          }
        }); 
    })

but it wont work , any suggestion ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions