Example #1
0
            this.delegateDOMEvent(this.main, this.options.event, '.df-tab-nav li', function(e) {
                var elem = e.target;
                if (!base.hasClass(elem, 'active')) {
                    this.clearStyle();

                    //tab
                    base.addClass(elem, 'active');

                    //content
                    var index = parseInt(base.attr(elem, 'index'), 10),
                        content = base.children(this.main, '.df-tab-content div')[index];
                    base.css(content, {
                        display: ''
                    });

                    /**
                     * 切换时触发
                     * @event onchange
                     * @param {Event} e 事件对象
                     */
                    this.fire('change', {
                        title: elem.innerHTML,
                        content: content.innerHTML,
                        index: index
                    });
                }
            });
Example #2
0
            this.delegateDOMEvent(this.main, 'click', 'a', function(e) {
                if (e && e.target) {
                    if (!base.hasClass(e.target, 'go') && !base.hasClass(e.target, 'actived')) {
                        var pageNum,
                            pageData = this.get('pageData'),
                            currentPageNum = parseInt(pageData.pageNo, 10);
                        switch (base.attr(e.target, 'name')) {
                            case 'previous':
                                pageNum = currentPageNum - 1;
                                if (pageNum <= 0) {
                                    return;
                                }
                                break;
                            case 'next':
                                pageNum = currentPageNum + 1;
                                if (pageNum > this.get('pageData').recordCount) {
                                    return;
                                }
                                break;
                            case 'num':
                                pageNum = base.html(e.target) - 0;
                                break;
                            case 'preStart':
                                if (currentPageNum == 1) {
                                    return;
                                } else {
                                    pageNum = 1;
                                }
                                break;
                            case 'nextEnd':
                                var pageCount = this.getPageCount();
                                if (currentPageNum == pageCount) {
                                    return;
                                } else {
                                    pageNum = pageCount;
                                }

                                break;
                        }
                        if (pageNum != void 0) {
                            this.changePageNo(pageNum);
                        }
                    }
                }
            });
Example #3
0
 this.addDOMEvent(this.label, 'click', function(e) {
     if (!this.isDisabled()) {
         if (this.options.type === 'radio') {
             this.group.uncheck();
             this.label.className = 'df-label ' + this.checked + ' ' + this.checkedHover;
         } else {
             if (this.isChecked()) { //label的点击先于input的点击
                 this.label.className = 'df-label ' + this.unchecked + ' ' + this.uncheckedHover;
             } else {
                 this.label.className = 'df-label ' + this.checked + ' ' + this.checkedHover;
             }
         }
         
         //IE7label的点击不会触发input的点击, IE8如果input被隐藏也不会触发
         if (this.ie8) {
             this.main.checked = base.hasClass(this.label, this.checked) ? true : false;
             this.fire('click', e);
         }
     }
 });