RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-319139

Слава Иванов's questions

Martin Hope
Слава Иванов
Asked: 2020-06-11 07:12:05 +0000 UTC

使用 JS 在多个元素上更改样式

  • 0

有一个脚本可以使用 css 样式更改滑块的位置。当滑块单独时,一切正常。但如果你将它们相乘,问题就开始了。如何解决这种情况?

$(document).ready(function() {
  $('#show').on('click', function() {
    console.log($('input[name=size]:checked', '.product__size-control').val());
  });

  $('.product__size-control-input').on('click', function(){
    let value = Number.parseInt(this.value);
    let currentElement = $(this).parent().parent().find('.product__size-control-selector');
    let currentLabel = $(this).parent().find('.product__size-control-label');

    console.log(value);

    switch(value){
      case 1: currentElement.css('transform', 'translateX(0%)'); 
      break;
      case 2: currentElement.css('transform', 'translateX(100%)');
      break;
      case 3: currentElement.css('transform', 'translateX(200%)');
      break;
    }

  });
});
* {
  box-sizing: border-box;
}

::-webkit-input-placeholder {
  color: #878686;
}

::-moz-placeholder {
  color: #878686;
}

:-ms-input-placeholder {
  color: #878686;
}

:-moz-placeholder {
  color: #878686;
}

::-ms-clear, ::-ms-reveal {
  display: none;
}

.product__size-control {
  position: relative;
  display: flex;
  margin: 0 0 16px;
  padding: 0;
  background-color: #f1f2f5;
  border-radius: 100px;
}

.product__size-control-selector {
  position: absolute;
  top: 0;
  left: 0;
  -webkit-transform: translateX(0);
  transform: translateX(0);
  width: 0;
  height: 100%;
  transition: -webkit-transform .2s ease-out;
  transition: transform .2s ease-out;
  transition: transform .2s ease-out, -webkit-transform .2s ease-out;
  background-color: #fff;
  border: 1px solid #babfd0;
  border-radius: 100px;
}

.product__size-control-item {
  position: relative;
  list-style: none;
  display: inline-block;
  vertical-align: top;
  width: 33.33333%;
  flex-grow: 1;
}

.product__size-control-label {
  position: relative;
  cursor: pointer;
  border-radius: 100px;
  border: 1px solid transparent;
  display: inline-block;
  height: 28px;
  width: 100%;
  color: rgba(55, 53, 53, .7);
  font-size: 12px;
  line-height: 26px;
  font-family: Dodo Medium, Helvetica, Arial, sans-serif;
  text-align: center;
  transition: color .2s ease-out;
}

.product__size-control-label:hover {
  color: #373535;
}

.product__size-control-label:focus {
  outline: 0;
}

.product__size-control-input {
  position: absolute;
  left: -9999px;
}

.product__size-control-input:checked + .product__size-control-label {
  color: #373535;
}

/*! CSS Used from: Embedded */
input {
  color: inherit;
  font: inherit;
  margin: 0;
}

input::-moz-focus-inner {
  border: 0;
  padding: 0;
}

input {
  line-height: normal;
}

input[type=radio] {
  box-sizing: border-box;
  padding: 0;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="product__size-control">
  <div class="product__size-control-selector" style="width: 33.3333%; transform: translateX(0%);"></div>
  <div class="product__size-control-item">
    <input type="radio" class="product__size-control-input" id="size_20_3"name="size" value="1" checked="">
    <label class="product__size-control-label" data-testid="menu__pizza_size_3"
		for="size_20_3">35&nbsp;см</label>
  </div>
  <div class="product__size-control-item">
    <input type="radio" class="product__size-control-input" id="size_20_2" name="size" value="2">
    <label class="product__size-control-label" data-testid="menu__pizza_size_2"
		for="size_20_2">30&nbsp;см</label>
  </div>
  <div class="product__size-control-item">
    <input type="radio" class="product__size-control-input" id="size_20_1"name="size" value="3">
    <label class="product__size-control-label" data-testid="menu__pizza_size_1"
		for="size_20_1">25&nbsp;см</label>
  </div>
</div>

javascript
  • 2 个回答
  • 10 Views
Martin Hope
Слава Иванов
Asked: 2020-02-12 00:57:06 +0000 UTC

无法刷新页面

  • 2

有一个带有代码的html页面

<script>
$(document).ready(function(){

var currentID = $('#SelecUserForRemove').val();
console.log("currentID= "+currentID)

  $("#testButton").click(function(){
    $.ajax({
    type: 'GET',
    url: "/user/"+currentID,
    success: function () {console.log("testButton")},
    error: function () { alert("Не удалось удалить элемент") }
    });
  });

//работа с option для удаления элемента
  $('#SelecUserForRemove').change(function() {
    currentID = $(this).val();
    console.log(("currentID= "+currentID))
   });
});
</script>

路线文件说:

GET     /                             controllers.UserController.index
GET/user/:id                       controllers.UserController.remove(id:Int)

删除方法:

  def remove(id: Int)() = Action {
    userService.removeUser(id)
    println(userService.findAll().toString())
    Redirect(routes.UserController.index())

  } 

请求离开并在服务器上进行处理,但 Redirect 方法不起作用, index 方法不起作用。为了查看更改,您需要手动刷新页面。如果在地址栏写/users/1,那么id=1的元素会被成功删除,并且会转换到index,我做错了什么?

javascript
  • 1 个回答
  • 10 Views
Martin Hope
Слава Иванов
Asked: 2020-02-10 02:05:41 +0000 UTC

如何将一个String中的两个值提取成两个变量?

  • 1

有一个字符串(User(2,Alex Mcqueen,26,None),99)。我需要从中提取“2”和“Alex Mcqueen”,并将这些值赋给变量。

val id: Int = 2
val name: String = "Alex Mcqueen"

怎么做?

регулярные-выражения
  • 1 个回答
  • 10 Views
Martin Hope
Слава Иванов
Asked: 2020-12-12 06:46:49 +0000 UTC

在Scala中按条件从另外两个创建列表

  • 3

有一个类:

case class Person (age: Int, name: String)

有两个列表:

val classRoom1 = List(Person(14, "Jimm"),Person(14, "Jack"), Person(13, "Ricky"))
val classRoom2 = List(Person(14, "Jimm"),Person(14, "Jack"), Person(13, "Ricky"), Person(13,"Susan"), Person(16, "Jack"))

有必要从第二个列表中选择名称字段,选择那些不在第一个列表中的对象并从中创建第三个列表。

val classRoom3 = List(Person(13,"Susan"))

如何以实用的风格做到这一点?

scala
  • 2 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5