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

Issues with scrollTo() in v5.7 #7

Closed
swashbuck opened this issue Nov 24, 2020 · 1 comment
Closed

Issues with scrollTo() in v5.7 #7

swashbuck opened this issue Nov 24, 2020 · 1 comment

Comments

@swashbuck
Copy link
Contributor

We recently noticed that upgrading to v5.7 of the framework breaks the scrollTo functionality in this plugin. From my understanding, the target of scrollTo() must now be an Adapt object.

The following changes to the click event listener seem to work in v5.6 and v5.7 (haven't tested anything older):

    onScrollPromptClick: function(event) {
      /* set scroll to selector depending on model type */
      switch (this.model.get('_type')) {
        case 'course':
          var nextCO = this.model.findDescendantModels('contentObject')[0].attributes._id;
          Adapt.scrollTo('.' + nextCO, { duration: 800 });
          break;
        case 'page':
          var nextArticle = this.model.findDescendantModels('article')[0].attributes._id;
          Adapt.scrollTo('.' + nextArticle, { duration: 800 });
          break;
        case 'component':
          var nextBlock = this.model.findRelativeModel('@block +1').attributes._id;
          Adapt.scrollTo('.' + nextBlock, { duration: 800 });
          break;
      }

However, I'm unsure if there's a cleaner way to do this? Also, for menus, this would scroll to the first contentObject menu item. So, it would assume that the first contentObject is the topmost menu item that you would logically want to scroll to.

Worth mentioning that the addition of the 'component' type here is dependent on PR #4 .

@moloko
Copy link
Contributor

moloko commented Feb 12, 2021

@swashbuck this should be fixed with Adapt FW v5.7.1 (see adaptlearning/adapt_framework#2928) but please reopen if not

@moloko moloko closed this as completed Feb 12, 2021
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

2 participants