Skip to content

Commit 715aa02

Browse files
author
MerryPanda
committed
about on.contentChange
1 parent 8f0e2b7 commit 715aa02

File tree

2 files changed

+38
-21
lines changed

2 files changed

+38
-21
lines changed

README.md

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jQuery.cuteScroll.defaults={
6767
},
6868
//element:{}, - you can change properties of every element you want
6969
on:{//related to events
70-
contentChange:false,// expects function which is called on content change -> onContentChange: <function>
70+
contentChange:false,// expects a function which is called on content change
7171
contentChangeShowScroller:true,// show scroller on content change if it is reasonable
7272
},
7373
//priority:1,//defines overlapping priority, not supported for now
@@ -95,14 +95,14 @@ jQuery.cuteScroll({
9595
```
9696

9797
### Commands
98-
- create:`<object>` - creates a scroller
99-
- recreate:`<object>` - recreates a scroller
100-
- update:`<object>` - updates settings
101-
- jumpToTop:`<boolean>` - jumps to the top of a scrollable div if TRUE
102-
- jumpToBottom:`<boolean>` - jumps to the bottom of a scrollable div if TRUE
103-
- log:`<string>` - logs some message via console
104-
- alert:`<string>` - alerts some message
105-
- remove:`<boolean>` - removes a scroller if TRUE
98+
- create:`object` - creates a scroller
99+
- recreate:`object` - recreates a scroller
100+
- update:`object` - updates settings
101+
- jumpToTop:`boolean` - jumps to the top of a scrollable div if TRUE
102+
- jumpToBottom:`boolean` - jumps to the bottom of a scrollable div if TRUE
103+
- log:`string` - logs some message via console
104+
- alert:`string` - alerts some message
105+
- remove:`boolean` - removes a scroller if TRUE
106106

107107
### AddClass, removeClass
108108
You can add or remove any class of a scroller element. All changes will be reversed on the remove command
@@ -127,17 +127,34 @@ jQuery.cuteScroll({
127127
You can also edit other elements properties by tag, class or id name or just change their css values. All changes will be reversed on the remove command
128128
```javascript
129129
jQuery.cuteScroll({
130-
update:{// is the command object
131-
element:{
132-
'myElementClass':{
133-
// any css settings
134-
height:'100rem',
135-
background:'red',
136-
addClass:'classNameToAdd'
137-
},
138-
'myOtherElementClass':{
139-
// any css settings
140-
removeClass:'classNameToRemove'
130+
create:{// is the command object
131+
bar:{
132+
// any css settings
133+
addClass:'newMyBarClass'
134+
removeClass:'formerMyBarClass'
135+
},
136+
area:{
137+
// any css settings
138+
width:'100vw',
139+
height:'100vh'
140+
},
141+
}
142+
});
143+
```
144+
145+
### Listeners
146+
#### on.contentChange
147+
Expects a function which will be called on a scrollable element content change
148+
```javascript
149+
jQuery.cuteScroll({
150+
create:{// is the command object
151+
on:{
152+
contentChange:function(e){// e - is the scrollable element jQuery object
153+
e.cuteScroll({
154+
update:{
155+
jumpToTop:true
156+
}
157+
})
141158
}
142159
}
143160
}

jquery.cutescroll.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ Version 1.0
788788
},
789789
//element:{}, - you can change properties of every element you want
790790
on:{//related to events
791-
contentChange:false,// expects function which is called on content change -> onContentChange: <function>
791+
contentChange:false,// expects a function which is called on content change
792792
contentChangeShowScroller:true,// show scroller on content change if it is reasonable
793793
},
794794
//priority:1,//defines overlapping priority, not supported for now

0 commit comments

Comments
 (0)