-
- ANDROID
- ANDROID_TABLET
- CHROME
- CHROME_VERSION
- DOC_MODE
- DOC_MODE_IE10_LT
- DOC_MODE_IE11_LT
- DOC_MODE_IE12_LT
- DOC_MODE_IE8_LT
- DOC_MODE_IE9_LT
- EDGE
- FIREFOX
- IE10_LT
- IE11_LT
- IE7_LT
- IE8_LT
- IE9_LT
- IE_COMPATIBLE
- IE_VERSION
- IPAD
- IPHONE
- LINUX
- MAC
- MOBILE
- MOBILE_IOS
- MOZILLA
- MSIE
- OPERA
- OPERA_MINI
- OS_VERSION
- SAFARI
- SAMSUNG
- SAMSUNG_VERSION
- SMART_PHONE
- TABLET
- TOUCH_DEVICE
- VERSION
- WEBKIT
- WEBKIT_VERSION
- WINDOWS
- WINDOWS_PHONE
- WINDOWS_TABLET
-
- addChild
- addClass
- addEvent
- attr
- children
- clone
- closest
- contentHeight
- contentWidth
- css
- each
- element
- hasClass
- hasEvent
- height
- html
- innerHeight
- innerWidth
- insertSWF
- match
- next
- outerHeight
- outerWidth
- parent
- prev
- prop
- rect
- remove
- removeAllEvent
- removeAttr
- removeChild
- removeClass
- removeEvent
- removeProp
- replaceWith
- scrollLeft
- scrollTop
- selector
- selectorAll
- text
- transition
- trigger
- width
each()
Type : public method
Support : 0.6
Return : Array
- 대상객체들의 갯수만큼 callback 반복 호출 후 결과 배열 반환.
반복문을 직접쓰는것 보다는 느리다.
Methods
-
each( callback ) : Arrayver 0.6~
Inline Style설정.-
callback : Functionfunction callback(item:Element, index:Int, array:Array):*
-
Example
//검색된 모든 개체에 background-color적용
$B( 'div.list' ).each( function ( el, idx, ary ) {
$B( el ).css( 'background-color: #ffaaff' );
});
//검색된 모든 개체에서 짝수개체에 background-color적용하고 해당 개체 배열 반환.
var result = $B( '.list' ).each( function ( el, idx, ary ) {
if ( idx%2 == 0 ) {
$B( el ).css( 'background-color: #ffaaff' );
return el;//return을 하지 않으면 result에도 결과가 반환되지 않는다.
}
});