- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2016 01:55 PM
I'm trying to add a library I've used as a scroller in CMS, but I'm having trouble figuring out how to get it to work in Service Portal. Here is a link to the jquery plugin:
Previously in CMS I would add the plugin as a UI script, call the UI script in a dynamic content block, and add one line of code in a script block to start the scrolling on a div with a ul element in it.
I have tried these steps in Service Portal:
- Create a widget which will hold a Knowledge base scroller
- Added the jquery-scrollbox as a dependency in the widget
- Added a div which holds the knowledge base articles to be scrolled (pulled from a server lookup):
<div id="demo" class="scroll-text">
<ul>
<div ng-repeat="article in c.data.news_articles">
<li>{{::article.desc}}</li>
</div>
</ul>
</div>
4. Tried to add code to the link function to start the scrolling, but that part isn't working
function(scope, elm){
var el = $(elm[0]).find('#demo');
el.scrollbox({
startDelay: 2, // Start delay (in seconds)
delay: 2, // Delay after each scroll event (in seconds)
linear: true,
step: 1,
speed: 50
});
}
I've tried many variations of the code in the link function, but can't get the scrollbox function to work. There are not any console errors.
Any help would be appreciated.
Thanks,
Ann Marie
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2016 02:24 AM
Hi Ann,
Try the below code in the link.
// This goes in link
function(scope, elem, attr) {
elem.find('#demo').scrollbox({
// set properties here
});
}
I created a quick POC to test and it works fine. See the below screenshot for code snippets.
If still, it does not work, see if you can run the below code in the console to see if it works, if not then there is some issue with how you have added the js as dependencies.
$('#demo').scrollbox({ linear: true, step: 1, delay: 0, speed: 100 });
Let me know how did it go.
Thanks,
Vinamra
PS: Hit like, Helpful or Correct depending on the impact of the response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2017 02:40 PM
Sorry for the delayed response here. I eventually just deleted / re-added everything and it worked, so there must have been something incorrectly linked in the dependency. Appreciate the help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2019 01:33 AM
Some plugins and CSS components depend on other plugins. If you include plugins individually, make sure to check for these dependencies in the docs. Also note that all plugins depend on jQuery (this means jQuery must be included before the plugin files).