Skip to content

Reinitialization #68

Description

@baksys

Hello,

I would like to know what would be the best way to reinitialize script after an AJAX call. I have post items, each in

container with data-color attribute. I use jquery.inview to change body background color:

$('article').on('inview', function(event, isInView) {
  if (isInView) {
    var spalva = $(this).attr('data-color');
    $('body').css('background-color', spalva);
  }
});

However, after and AJAX call this script only works with posts displayed on page load. Therefore I need to reinitialize jquery.inview after the call. I would be very grateful if someone could help me what would be the best way to do it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions