Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 如何从“迁移”;在1.4.0以下_Css_Less - Fatal编程技术网

Css 如何从“迁移”;在1.4.0以下

Css 如何从“迁移”;在1.4.0以下,css,less,Css,Less,升级到1.4.0以下版本后,在以下代码的第一行出现编译错误: (~"@{containerClass} .scrollElement.nth-child-@{index}") { // the resulting css left: @index * @seTotalWidth - @seTotalWidth; } 编译错误:无法识别的输入 这段代码在1.4.0版本中应该是什么样子 我注意到~”已被弃用,但不知道如何对多个元素使用它 “完整”来源供参考 // C

升级到1.4.0以下版本后,在以下代码的第一行出现编译错误:

   (~"@{containerClass} .scrollElement.nth-child-@{index}") {
     // the resulting css
     left: @index * @seTotalWidth - @seTotalWidth;
   }
编译错误:无法识别的输入

这段代码在1.4.0版本中应该是什么样子

我注意到~”已被弃用,但不知道如何对多个元素使用它

“完整”来源供参考

// Caller
.setPositionLeftForScrollElements ("#fgScroller", @maxFeaturedGuides + 2, @seTotalWidth);

// will be called as long the index is above 0
.setPositionLeftForScrollElements (@containerSelector, @index, @seTotalWidth) when (@index > 0) {

  ~"@{containerSelector} .scrollElement.nth-child-@{index}" {
    // the resulting css
    left: @index * @seTotalWidth - @seTotalWidth;
  }
  ~"@{containerSelector} .scrollElement:nth-child(@{index})" {
    // the resulting css
    left: @index * @seTotalWidth - @seTotalWidth;
  }

  // next iteration
  .setPositionLeftForScrollElements(@containerSelector, @index - 1, @seTotalWidth);
}
应用@seven Phase max建议的更改后的源代码

.setPositionLeftForScrollElements (~"#fgScroller", @maxFeaturedGuides + 2, @seTotalWidth);

// will be called as long the index is above 0
.setPositionLeftForScrollElements (@containerSelector, @index, @seTotalWidth) when (@index > 0) {

  @{containerSelector} .scrollElement.nth-child-@{index} {
    // the resulting css
    left: @index * @seTotalWidth - @seTotalWidth;
  }
  @{containerSelector} .scrollElement:nth-child(@{index}) {
    // the resulting css
    left: @index * @seTotalWidth - @seTotalWidth;
  }

  // next iteration
  .setPositionLeftForScrollElements(@containerSelector, @index - 1, @seTotalWidth);
}

只需删除括号和引号:

@{containerClass} .scrollElement.nth-child-@{index} {
     left: @index * @seTotalWidth - @seTotalWidth;
}
更新,这是完整的代码段,复制并粘贴此代码段以查看结果:

.setPositionLeftForScrollElements(div, 3, 100px); // start the loop

// will be called as long the index is above 0
.setPositionLeftForScrollElements(@containerSelector, @index, @seTotalWidth) when (@index > 0) {

  @{containerSelector} .scrollElement.nth-child-@{index} {
    // the resulting css
    left: @index * @seTotalWidth - @seTotalWidth;
  }

  @{containerSelector} .scrollElement:nth-child(@{index}) {
    // the resulting css
    left: @index * @seTotalWidth - @seTotalWidth;
  }

  // next iteration
  .setPositionLeftForScrollElements(@containerSelector, @index - 1, @seTotalWidth);
}
确保--strict math选项处于禁用状态(否则需要向所有数学表达式添加paren)


好的,由于我的主要兴趣在于各种较少的优化,这里有几个提示(以防万一):


只需删除括号和引号:

@{containerClass} .scrollElement.nth-child-@{index} {
     left: @index * @seTotalWidth - @seTotalWidth;
}
更新,这是完整的代码段,复制并粘贴此代码段以查看结果:

.setPositionLeftForScrollElements(div, 3, 100px); // start the loop

// will be called as long the index is above 0
.setPositionLeftForScrollElements(@containerSelector, @index, @seTotalWidth) when (@index > 0) {

  @{containerSelector} .scrollElement.nth-child-@{index} {
    // the resulting css
    left: @index * @seTotalWidth - @seTotalWidth;
  }

  @{containerSelector} .scrollElement:nth-child(@{index}) {
    // the resulting css
    left: @index * @seTotalWidth - @seTotalWidth;
  }

  // next iteration
  .setPositionLeftForScrollElements(@containerSelector, @index - 1, @seTotalWidth);
}
确保--strict math选项处于禁用状态(否则需要向所有数学表达式添加paren)


好的,由于我的主要兴趣在于各种较少的优化,这里有几个提示(以防万一):


只需删除括号和引号:

@{containerClass} .scrollElement.nth-child-@{index} {
     left: @index * @seTotalWidth - @seTotalWidth;
}
更新,这是完整的代码段,复制并粘贴此代码段以查看结果:

.setPositionLeftForScrollElements(div, 3, 100px); // start the loop

// will be called as long the index is above 0
.setPositionLeftForScrollElements(@containerSelector, @index, @seTotalWidth) when (@index > 0) {

  @{containerSelector} .scrollElement.nth-child-@{index} {
    // the resulting css
    left: @index * @seTotalWidth - @seTotalWidth;
  }

  @{containerSelector} .scrollElement:nth-child(@{index}) {
    // the resulting css
    left: @index * @seTotalWidth - @seTotalWidth;
  }

  // next iteration
  .setPositionLeftForScrollElements(@containerSelector, @index - 1, @seTotalWidth);
}
确保--strict math选项处于禁用状态(否则需要向所有数学表达式添加paren)


好的,由于我的主要兴趣在于各种较少的优化,这里有几个提示(以防万一):


只需删除括号和引号:

@{containerClass} .scrollElement.nth-child-@{index} {
     left: @index * @seTotalWidth - @seTotalWidth;
}
更新,这是完整的代码段,复制并粘贴此代码段以查看结果:

.setPositionLeftForScrollElements(div, 3, 100px); // start the loop

// will be called as long the index is above 0
.setPositionLeftForScrollElements(@containerSelector, @index, @seTotalWidth) when (@index > 0) {

  @{containerSelector} .scrollElement.nth-child-@{index} {
    // the resulting css
    left: @index * @seTotalWidth - @seTotalWidth;
  }

  @{containerSelector} .scrollElement:nth-child(@{index}) {
    // the resulting css
    left: @index * @seTotalWidth - @seTotalWidth;
  }

  // next iteration
  .setPositionLeftForScrollElements(@containerSelector, @index - 1, @seTotalWidth);
}
确保--strict math选项处于禁用状态(否则需要向所有数学表达式添加paren)


好的,由于我的主要兴趣在于各种较少的优化,这里有几个提示(以防万一):


这不起作用。我已将整个代码段添加到原始问题中。您的修复和调用者中的此更改起到了作用:
.setPositionLeftForScrollements(~“#fgScroller”、@maxFeaturedGuides+2、@seTotalWidth);
这不起作用。我已将整个代码片段添加到原始问题中。您的修复和调用者中的此更改成功了:
.setPositionLeftForScrollements(~“#fgScroller”、@maxFeaturedGuides+2、@seTotalWidth);
这不起作用。我已将整个代码片段添加到原始问题中。您的修复和调用者中的此更改成功了:
.setPositionLeftForScrollements(~“#fgScroller”、@maxFeaturedGuides+2、@seTotalWidth);
这不起作用。我已将整个代码段添加到原始问题中。您的修复和调用者中的此更改成功了:
。SetPositionLeftForScrollements(~“#fgScroller”、@maxFeaturedGuides+2、@seTotalWidth);