Using Simplebar Plugin I try to create scrollbar with class element like this documents. but in action this plugin doesn't work.
HTML:
<div class="simple-bar">
//data
</div>
JS:
$('.simple-bar').each(element, new SimpleBar());
Using Simplebar Plugin I try to create scrollbar with class element like this documents. but in action this plugin doesn't work.
HTML:
<div class="simple-bar">
//data
</div>
JS:
$('.simple-bar').each(element, new SimpleBar());
Copyright © 2021 Jogjafile Inc.
This is the example in the SimpleBar documentation that your question is relating two. This example in the documentation is flawed.
There are two forms of
each()in jQuery. There is thejQuery.eachmethod and thejQuery.fn.eachmethod, which is a wrapper around the first one. The difference being thatjQuery.fnmethods are designed to act upon an instance of jQuery with a result stack in it (ex. the result of a$(...)expression). ThejQuery.eachis not written to operate upon an existing instance, and is instead expected to be given both the elements to operate upon, and the callback related to the work needing to be done.Given this, the usage that their documentation shows is incorrectly trying to use the
jQuery.fn.eachas if it were thejQuery.eachform.This form correctly uses the
jQuery.fn.eachversion, giving it just the callback that will be used to perform work against the result stack in the jQuery instance.