일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- 홈페이지제작
- 웹퍼블리싱
- php
- 문자열 뒤집기
- 마우스 오른쪽 버튼
- 자바스크립트
- 무료 홈페이지
- 퍼빌리셔
- 우편번호 API
- 웹퍼블리셔
- 마우스오른쪽
- 무료 홈페이지 제작
- 웹호스팅
- 무료제작
- 복사방지
- 무료사이트
- 글자뒤집기
- 무료 호스팅
- 무료
- 무료홈페이지
- 우체국 우편번호
- 무료 웹 호스팅
- 새우편번호
- 무료서버
- 무료호스팅
- 클릭해제
- postcodify
- 자바키워드
- 호스팅
- php호스팅
Archives
- Today
- Total
Developer Factory
Selectbox JQUERY 플러그인 입니다 본문
Jquery Selectbox 플러그인 입니다
참고 주소 : http://marcj.github.io/jquery-selectBox/
jQuery selectBox: A styleable replacement for SELECT elements
Licensed under the MIT license: http://opensource.org/licenses/MIT
Features
- Supports OPTGROUPS
- Supports standard dropdown controls
- Supports multi-select controls (i.e. multiple="multiple")
- Supports inline controls (i.e. size="5")
- Fully accessible via keyboard
- Shift + click (or shift + enter) to select a range of options in multi-select controls
- Type to search when the control has focus
- Auto-height based on the size attribute (to use, omit the height property in your CSS!)
- Tested in IE7-IE9, Firefox 3-4, recent WebKit browsers, and Opera
Usage
Download the latest version: https://github.com/marcj/jquery-selectBox/releases
Link to the JS file:
<script src="jquery.selectbox.js" type="text/javascript"></script>
Add the CSS file (or append contents to your own stylesheet):
<link href="jquery.selectbox.css" rel="stylesheet" type="text/css" />
To initialize:
// default
$('select').selectBox();
// or with custom settings
$('select').selectBox({
mobile: true,
menuSpeed: 'fast'
});
Settings
Key | Default | Values | Description |
---|---|---|---|
mobile | false | Boolean | Disables the widget for mobile devices |
menuTransition | default | default ,slide ,fade | The show/hide transition for dropdown menus |
menuSpeed | normal | slow ,normal ,fast | The show/hide transition speed |
loopOptions | false | Boolean | Flag to allow arrow keys to loop through options |
topPositionCorrelation | 0 | Integer | Will be plused to top position if droplist will be show at the top |
bottomPositionCorrelation | 0 | Integer | Will be substracted from top position if droplist will be shown at the bottom |
hideOnWindowScroll | true | Boolean | If false then showed droplist will not hide itself on window scroll event |
keepInViewport | true | Boolean | If set to false, the droplist will be always open towards the bottom |
To specify settings after the init, use this syntax:
$('select').selectBox('settings', {settingName: value, ... });
Methods
To call a method use this syntax:
$('select').selectBox('methodName', [option]);
Available methods
Key | Description |
---|---|
create | Creates the control (default) |
destroy | Destroys the selectBox control and reverts back to the original form control |
disable | Disables the control (i.e. disabled="disabled") |
enable | Enables the control |
value | If passed with a value, sets the control to that value; otherwise returns the current value |
options | If passed either a string of HTML or a JSON object, replaces the existing options; otherwise Returns the options container element as a jQuery object |
control | Returns the selectBox control element (an anchor tag) for working with directly |
refresh | Updates the selectBox control's options based on the original controls options |
instance | Returns the SelectBox instance, where you have more methods available (only in v1.2.0-dev |
available) as in the SelectBox class below. |
API SelectBox
You can instantiate the selectBox also through a classic OOP way:
var selectBox = new SelectBox($('#mySelectBox'), settings = {});
selectBox.showMenu();
The public methods are:
refresh()
destroy()
disable()
enable()
getLabelClass()
getLabelText()
getSelectElement()
getOptions(String type = 'inline'|'dropdown')
hideMenus()
showMenu()
setLabel()
setOptions(Object options)
setValue(String value)
removeHover(HTMLElement li)
addHover(HTMLElement li)
disableSelection(HTMLElement selector)
generateOptions(jQuery self, jQuery options)
handleKeyDown(event)
handleKeyPress(event)
init(options)
keepOptionInView(jQuery li, Boolean center)
refresh()
removeHover(HTMLElement li)
selectOption(HTMLElement li, event)
Events
Events are fired on the original select element. You can bind events like this:
$('select').selectBox().change(function () {
alert($(this).val());
});
Available events
Key | Description |
---|---|
focus | Fired when the control gains focus |
blur | Fired when the control loses focus |
change | Fired when the value of a control changes |
beforeopen | Fired before a dropdown menu opens (cancelable) |
open | Fired after a dropdown menu opens (not cancelable) |
beforeclose | Fired before a dropdown menu closes (cancelable) |
close | Fired after a dropdown menu closes (not cancelable) |
Known Issues
- The blur and focus callbacks are not very reliable in IE7. The change callback works fine.
Credits
Original plugin by Cory LaViska of A Beautiful Site, LLC. (http://www.abeautifulsite.net/)
'Developer > Jquery' 카테고리의 다른 글
[jQury] 1. 함수 - (예제15장) .addClass .removeClass .attr('속성값', 값); .removeAttr .html() .text() .empty() .appendTo( 'body') .append .clone() (0) | 2014.06.24 |
---|---|
jdbc 데이터베이스 연결 연습 1 (0) | 2014.06.24 |
정규 표현식 Regular Expressions (0) | 2014.06.24 |
jQuery 제이쿼리 소스 관련 게시판 모음 (1) | 2014.06.15 |
jquery를 이용한 select box 제어 (0) | 2014.06.12 |