?? carousel-beta.js
字號:
* @property _navBtns * @private */ _navBtns: null, /** * The Carousel navigation. * * @property _navEl * @private */ _navEl: null, /** * Status of the next navigation item. * * @property _nextEnabled * @private */ _nextEnabled: true, /** * The Carousel pages structure. * This is an object of the total number of pages and the current page. * * @property _pages * @private */ _pages: null, /** * Status of the previous navigation item. * * @property _prevEnabled * @private */ _prevEnabled: true, /** * Whether the Carousel size needs to be recomputed or not? * * @property _recomputeSize * @private */ _recomputeSize: true, /* * CSS classes used by the Carousel component */ CLASSES: { /** * The class name of the Carousel navigation buttons. * * @property BUTTON * @default "yui-carousel-button" */ BUTTON: "yui-carousel-button", /** * The class name of the Carousel element. * * @property CAROUSEL * @default "yui-carousel" */ CAROUSEL: "yui-carousel", /** * The class name of the container of the items in the Carousel. * * @property CAROUSEL_EL * @default "yui-carousel-element" */ CAROUSEL_EL: "yui-carousel-element", /** * The class name of the Carousel's container element. * * @property CONTAINER * @default "yui-carousel-container" */ CONTAINER: "yui-carousel-container", /** * The class name of the Carousel's container element. * * @property CONTENT * @default "yui-carousel-content" */ CONTENT: "yui-carousel-content", /** * The class name of a disabled navigation button. * * @property DISABLED * @default "yui-carousel-button-disabled" */ DISABLED: "yui-carousel-button-disabled", /** * The class name of the first Carousel navigation button. * * @property FIRST_NAV * @default " yui-carousel-first-button" */ FIRST_NAV: " yui-carousel-first-button", /** * The class name of a first disabled navigation button. * * @property FIRST_NAV_DISABLED * @default "yui-carousel-first-button-disabled" */ FIRST_NAV_DISABLED: "yui-carousel-first-button-disabled", /** * The class name of a first page element. * * @property FIRST_PAGE * @default "yui-carousel-nav-first-page" */ FIRST_PAGE: "yui-carousel-nav-first-page", /** * The class name of the Carousel navigation button that has focus. * * @property FOCUSSED_BUTTON * @default "yui-carousel-button-focus" */ FOCUSSED_BUTTON: "yui-carousel-button-focus", /** * The class name of a horizontally oriented Carousel. * * @property HORIZONTAL * @default "yui-carousel-horizontal" */ HORIZONTAL: "yui-carousel-horizontal", /** * The navigation element container class name. * * @property NAVIGATION * @default "yui-carousel-nav" */ NAVIGATION: "yui-carousel-nav", /** * The class name of the next navigation link. This variable is not * only used for styling, but also for identifying the link within * the Carousel container. * * @property NEXT_PAGE * @default "yui-carousel-next" */ NEXT_PAGE: "yui-carousel-next", /** * The class name for the navigation container for prev/next. * * @property NAV_CONTAINER * @default "yui-carousel-buttons" */ NAV_CONTAINER: "yui-carousel-buttons", /** * The class name of the previous navigation link. This variable * is not only used for styling, but also for identifying the link * within the Carousel container. * * @property PREV_PAGE * @default "yui-carousel-prev" */ PREV_PAGE: "yui-carousel-prev", /** * The class name of the selected item. * * @property SELECTED_ITEM * @default "yui-carousel-item-selected" */ SELECTED_ITEM: "yui-carousel-item-selected", /** * The class name of the selected paging navigation. * * @property SELECTED_NAV * @default "yui-carousel-nav-page-selected" */ SELECTED_NAV: "yui-carousel-nav-page-selected", /** * The class name of a vertically oriented Carousel. * * @property VERTICAL * @default "yui-carousel-vertical" */ VERTICAL: "yui-carousel-vertical", /** * The class name of the (vertical) Carousel's container element. * * @property VERTICAL_CONTAINER * @default "yui-carousel-vertical-container" */ VERTICAL_CONTAINER: "yui-carousel-vertical-container", /** * The class name of a visible Carousel. * * @property VISIBLE * @default "yui-carousel-visible" */ VISIBLE: "yui-carousel-visible" }, /* * Configuration attributes for configuring the Carousel component */ CONFIG: { /** * The offset of the first visible item in the Carousel. * * @property FIRST_VISIBLE * @default 0 */ FIRST_VISIBLE: 0, /** * The element to be used as the progress indicator when the item * is still being loaded. * * @property ITEM_LOADING * @default The progress indicator (spinner) image */ ITEM_LOADING: "<img " + "src=\"../../build/carousel/assets/ajax-loader.gif\" " + "alt=\"Loading\" " + "style=\"margin-top:-32px;position:relative;top:50%;\">", /** * The tag name of the Carousel item. * * @property ITEM_TAG_NAME * @default "LI" */ ITEM_TAG_NAME: "LI", /** * The maximum number of pager buttons allowed beyond which the UI * of the pager would be a drop-down of pages instead of buttons. * * @property MAX_PAGER_BUTTONS * @default 5 */ MAX_PAGER_BUTTONS: 5, /** * The minimum width of the Carousel container to support the * navigation buttons. * * @property MIN_WIDTH * @default 99 */ MIN_WIDTH: 99, /** * The number of visible items in the Carousel. * * @property NUM_VISIBLE * @default 3 */ NUM_VISIBLE: 3, /** * The tag name of the Carousel. * * @property TAG_NAME * @default "OL" */ TAG_NAME: "OL" }, /* * Internationalizable strings in the Carousel component */ STRINGS: { /** * The next navigation button name/text. * * @property NEXT_BUTTON_TEXT * @default "Next Page" */ NEXT_BUTTON_TEXT: "Next Page", /** * The prefix text for the pager in case the UI is a drop-down. * * @property PAGER_PREFIX_TEXT * @default "Go to page " */ PAGER_PREFIX_TEXT: "Go to page ", /** * The previous navigation button name/text. * * @property PREVIOUS_BUTTON_TEXT * @default "Previous Page" */ PREVIOUS_BUTTON_TEXT: "Previous Page" }, /* * Public methods of the Carousel component */ /** * Insert or append an item to the Carousel. * * @method addItem * @public * @param item {String | Object | HTMLElement} The item to be appended * to the Carousel. If the parameter is a string, it is assumed to be * the content of the newly created item. If the parameter is an * object, it is assumed to supply the content and an optional class * and an optional id of the newly created item. * @param index {Number} optional The position to where in the list * (starts from zero). * @return {Boolean} Return true on success, false otherwise */ addItem: function (item, index) { var className, content, el, elId, numItems = this.get("numItems"); if (!item) { return false; } if (JS.isString(item) || item.nodeName) { content = item.nodeName ? item.innerHTML : item; } else if (JS.isObject(item)) { content = item.content; } else { return false; } className = item.className || ""; elId = item.id ? item.id : Dom.generateId(); if (JS.isUndefined(index)) { this._itemsTable.items.push({ item : content, className : className, id : elId }); } else { if (index < 0 || index >= numItems) { return false; } this._itemsTable.items.splice(index, 0, { item : content, className : className, id : elId }); } this._itemsTable.numItems++; if (numItems < this._itemsTable.items.length) { this.set("numItems", this._itemsTable.items.length); } this.fireEvent(itemAddedEvent, { pos: index, ev: itemAddedEvent }); return true; }, /** * Insert or append multiple items to the Carousel. * * @method addItems * @public * @param items {Array} An array of items to be added with each item * representing an item, index pair [{item, index}, ...] * @return {Boolean} Return true on success, false otherwise */ addItems: function (items) { var i, n, rv = true; if (!JS.isArray(items)) { return false; } for (i = 0, n = items.length; i < n; i++) { if (this.addItem(items[i][0], items[i][1]) === false) { rv = false; } } return rv; }, /** * Remove focus from the Carousel. * * @method blur * @public
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -