帖子
帖子
用户
博客
课程
显示全部楼层
66
帖子
2
勋章
273
Y币

[其他] 分类导航,滚动怎么没有效果

[复制链接]
发表于 2018-6-26 15:45:43
本帖最后由 永恒淘榜 于 2018-6-26 15:49 编辑

没事写了个分类顶部导航,点击到奶瓶后,不能自动滚动,可以左右拖动。 Screenshot_2018-06-26-15-38-45.png

  1.         function changeClass(index) {
  2.                 var tabs = $api.domAll('#tab .tabItem');
  3.                 for (var i = 0; i < tabs.length; i++) {
  4.                         if (i === index) {
  5.                                 $api.addCls(tabs[i], 'active')
  6.                         } else {
  7.                                 $api.removeCls(tabs[i], 'active')
  8.                         }
  9.                 }
  10.         }

  11.         function moveNav(index) {
  12.                 var noDiy = [];
  13.                 for (var i = 0; i < topNavMenu.length; i++) {
  14.                         if (topNavMenu[i].isdiy == 0) {
  15.                                 noDiy.push(topNavMenu[i]);
  16.                         }
  17.                 }
  18.                 if (index >= 6 && index < noDiy.length - 2) {
  19.                         $api.dom('#moveBox').style.marginLeft = (-(index - 2) * 100) + 'px'
  20.                 }
  21.                 if (index < 6) {
  22.                         $api.dom('#moveBox').style.marginLeft = 0;
  23.                 }
  24.         }

  25.         function tab(index) {
  26.                 changeClass(index);
  27.                 moveNav(index);
  28.                 api.setFrameGroupIndex({
  29.                         name: 'group',
  30.                         index: index,
  31.                         reload: false,
  32.                         scroll: true
  33.                 });
  34.         }
复制代码


380
帖子
4
勋章
6
Y币
66
帖子
2
勋章
273
Y币
技术支持-F 发表于 2018-6-26 19:02
https://docs.apicloud.com/Client-API/Nav-Menu/NVNavigationBar

这个模块有这个功能

看了这个模块,是可以,全部功能都有
您需要登录后才可以回帖 登录

本版积分规则