Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

轮子选中文字颜色 #75

Open
bdsn123 opened this issue Aug 26, 2019 · 1 comment
Open

轮子选中文字颜色 #75

bdsn123 opened this issue Aug 26, 2019 · 1 comment
Labels

Comments

@bdsn123
Copy link

bdsn123 commented Aug 26, 2019

这个能设置当前选中的文字颜色么?

@wolichuang
Copy link

改1

//530-546
// 获取 li 内容
    getInnerHtml: function (sliderIndex) {
      var _this = this;
      var index = _this.getIndex(_this.curDistance[sliderIndex]);
      this.setClassActive(sliderIndex);
      return _this.slider[sliderIndex].getElementsByTagName('li')[index].innerHTML;
    },
    // 处理高亮
    setClassActive: function (sliderIndex) {
      var _this = this;
      var _index = _this.getIndex(_this.curDistance[sliderIndex]);
      var _lists = _this.slider[sliderIndex].getElementsByTagName('li');
      for (let i = 0; i < _lists.length; i++) {
        _lists[i].className = "";
      }
      _lists[_index].className = 'inactive';
    },

改2

// 688-699
// 监听
    addListenerAll: function () {
      var _this = this;
      for (let index = 0; index < _this.slider.length; index++) {
        //手势监听
        (function (index) {
          var sliderLists = _this.slider[index].getElementsByTagName('li');
          sliderLists[_this.initPosition].className = 'inactive';
          _this.addListenerWheel(_this.wheel[index], index);
        })(index);
      }
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants