Comments (7)
hey joeytheman, can you set up a demo page where this issue is visible?
from jquery-slimscroll.
This feature would be lovely indeed.
from jquery-slimscroll.
In my case it is not needed. I didn't initially realize the scroller automatically adjusted if additional content was added. Before I discovered this I wrote some code to remove the slim scrol div s and re initialize slim scroll after content was added.
from jquery-slimscroll.
I need it to adjust the height in case the size of the container changes.
from jquery-slimscroll.
Did you test if the slim scroll automatically adjusts?
If it doesn't here is the function I came up with.
window.activateSlimScroll = function() {
var height, opts, slimscroll, slimscrolls, t, t_height, _i, _len;
slimscrolls = $('.newSlimScroll');
for (_i = 0, _len = slimscrolls.length; _i < _len; _i++) {
slimscroll = slimscrolls[_i];
t = $(slimscroll);
}
// Check if slimScroll is already activated
if (t.parent().attr('class') === 'slimScrollDiv') {
t.unwrap();
t.parent().find('.slimScrollBar, .slimScrollRail').remove();
}
// Activate slimScroll
t_height = t.height();
height = t.data('slim-scroll-height');
opts = {
height: height,
start: t.data('slim-scroll-start')
};
if (t_height > 250) {
if (height) {
if (t_height > height) {
t.slimScroll(opts);
}
} else {
t.slimScroll(opts);
}
}
return slimscrolls.removeClass('newSlimScroll');
};
It runs in an ajax:complete
callback on elements with the .newSlimScroll
class checking for an existing slim scroll and removing it before initializing a new one. Additional options can be set using html5 data attribute.
Let me know if you have any questions or if I can be of any other assistance.
from jquery-slimscroll.
For what I saw it doesn't really adjust. Also if I call it twice I get two scrollbars.
I'd like to keep all logic related to slimScroll ion the slimScroll library, hence the importance of this this issue to me.
from jquery-slimscroll.
from version 1.1.0 onwards slimscroll will recalculate the scrollbar size when you call it again on the same element.
So now, in your ajax callbacks you can simply call: $("#myElement").slimScroll() again.
from jquery-slimscroll.
Related Issues (20)
- archive project / search for maintainers
- Need to update after adding elements to section.
- t is not defined
- AllowPageScroll Not Work
- FYI Your website is broken
- when i inspect the browser slimScrollDiv is working otherwise it is not visible HOT 2
- Windows scroll inside child element(combobox) does not work with SlimScroll in Parent div
- Does not work in touch devices
- It's hard to use horizontal and vertical scrolls - page starts glitching and freezing
- [Violation] output in chrome console HOT 2
- Scroll child div also scrolls the window HOT 2
- slimscoll event is not capturing bottom event HOT 1
- How to capture scroll events
- Auto scroll at top after expanding menu
- Chrome, Unable to preventDefault inside passive event listener due to target being treated as passive, error HOT 2
- Abandoned Project.
- Sidebar issue HOT 1
- Solution for "[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive." HOT 1
- SlimScroll creating issue in scrolling inner dropdowns in a form
- allowPageScroll is not working with latest "jQuery Core 3.7.0"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-slimscroll.