Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wont work if we rearrange items after page load #13

Open
Hretic opened this issue Jan 15, 2015 · 0 comments
Open

wont work if we rearrange items after page load #13

Hretic opened this issue Jan 15, 2015 · 0 comments

Comments

@Hretic
Copy link

Hretic commented Jan 15, 2015

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 ?

@Hretic Hretic changed the title wont work if we rearrange items after page load via jquery wont work if we rearrange items after page load Jan 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant