Skip to content

kkh975/Scrollbar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Scrollbar

##Introduce ์›น๋ธŒ๋ผ์šฐ์ €์—์„œ ์‚ฌ์šฉ๋˜๋Š” ๊ธฐ๋ณธ ์Šคํฌ๋กค๋ฐ”์ž…๋‹ˆ๋‹ค.

Demo

##How to Use ####HTML ์•„๋ž˜์™€ ๊ฐ™์ด ๊ฐ์‹ธ๋Š” ํƒœ๊ทธ์™€ ๋ณด์ผ ์˜์—ญ์˜ ํƒœ๊ทธ, ๊ทธ๋ฆฌ๊ณ  ๋‚ด์šฉ ํƒœ๊ทธ๋กœ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค.

<div class="wrap">
	<div class="box">
		<div class="content">
			...
		</div>
	</div>
</div>

####CSS ์ „์ฒด ๊ฐ์‹ธ๋Š” ํƒœ๊ทธ์™€ ๋‚ด์šฉ ๊ฐ์‹ธ๋Š” ํƒœ๊ทธ๋Š” ๋ฐ˜๋“œ์‹œ ๊ฐ€๋กœ, ์„ธ๋กœ ๊ธธ์ด๋ฅผ ๋ช…์‹œํ•˜์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค๋งŒ ์„ธ๋กœ ๊ธธ์ด๋ฅผ ํผ์„ผํŠธ๋กœ ๋ช…์‹œํ•  ๊ฒฝ์šฐ ํ™”๋ฉด์—์„œ ๋ณด์ด์ง€ ์•Š์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•œ๊ฐ€์ง€ ์ฃผ์˜ํ•  ์ ์€, Javascript๋กœ ์ƒ์„ฑ๋œ ํด๋ž˜์Šค(๊ธฐ๋ณธ: customClass)๋ฅผ ์ค‘์‹ฌ์œผ๋กœ ์ž‘์„ฑํ•˜์—ฌ ํ•ฉ๋‹ˆ๋‹ค.

.customClass {
	width: 100%;
	height: 250px;
}
.customClass-viewport {
	width: 100%;
	height: 248px;
	border: 1px solid #e5e5e5;
}
.customClass-scrollbar {
	top: 0px;
	right: 0px;
	width: 15px;
}
.customClass-track {
	width: 15px;
	height: 15px;
	background: #e5e5e5;
}
.customClass-thumb {
	width: 15px;
	height: 15px;
	background: #ccc;
}
.customClass-first-thumb {
	width: 15px;
	height: 15px;
	background: #b3b3b3;
}
.customClass-end-thumb {
	width: 15px;
	height: 15px;
	background: #b3b3b3;
}

####JAVASCRIPT jquery ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์ž‘์„ฑํ•  ๊ฒฝ์šฐ ์•„๋ž˜์™€ ๊ฐ™์ด ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค.

$( '.customClass' ).scrollbar( );

javascript์œผ๋กœ ์ž‘์„ฑํ•  ๊ฒฝ์šฐ ์•„๋ž˜์™€ ๊ฐ™์ด ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค.

new Scrollbar( {
	wrapping: document.getElementsByClassName( 'customClass' )[ 0 ],
	viewport: document.getElementsByClassName( 'customClass-viewport' )[ 0 ],
	contents: document.getElementsByClassName( 'customClass-contents' )[ 0 ]
} );

##method

  • update: ๋‚ด์šฉ ์—…๋ฐ์ดํŠธ

####jquery option

  • $wrapping: {jQuery Selector} (default: $( this )) ์ „์ฒด ๊ฐ์Œˆ
  • $viewport: {jQuery Selector} (default: $( this ).find( '>[class$="viewport"]' )) ๋ณด์ด๋Š” ์˜์—ญ
  • $contents: {jQuery Selector} (default: $( this ).find( '>[class$="contents"]' )) ๋‚ด์šฉ ์˜์—ญ

####javascript option

  • wrapping: required {elements} (default: null) ์ „์ฒด ๊ฐ์Œˆ
  • viewport: required {elements} (default: null) ๋ณด์ด๋Š” ์˜์—ญ
  • contents: required {elements} (default: null) ๋‚ด์šฉ ์˜์—ญ

####common option

  • axis: {String} (Default: 'y') ์Šคํฌ๋กค๋ฐ”๊ฐ€ ์ƒ์„ฑ๋  ์ถ•
  • wheel: {Integer} (Default: 40) ๋งˆ์šฐ์Šค ํœ ๋กœ ์Šคํฌ๋กคํ•  ์‹œ ์Šคํฌ๋กค๋ฐ” ์›€์ง์ผ ์ •๋„
  • customClass: {String} (Default: 'customClass') ์‚ฌ์šฉ์ž ํด๋ž˜์Šค
  • appendButton: {Boolean} (Default: true) ์ƒ/ํ•˜ ์Šคํฌ๋กค๋ฐ” ๋ฒ„ํŠผ ์‚ฌ์šฉ ์—ฌ๋ถ€, ํ˜น์€ ์ขŒ/์šฐ
  • create: {Function} (default: null) ์ƒ์„ฑ์‹œ ์ฝœ๋ฐฑ ํ•จ์ˆ˜
  • update: {Function} (default: null) ์—…๋ฐ์ดํŠธ ํ›„ ์ฝœ๋ฐฑ ํ•จ์ˆ˜
  • active: {Function} (default: null) ์Šคํฌ๋กค ํ›„ ์ฝœ๋ฐฑ ํ•จ์ˆ˜

Copyrights

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published