简体   繁体   English

表单“提交按钮”不会滑动

[英]Form 'submit button' won't SLIDE

Would you please tell me why the slide function won't work ? 你能告诉我为什么滑动功能不起作用吗?

https://jsfiddle.net/lcoulon/51gn2v45/ https://jsfiddle.net/lcoulon/51gn2v45/

It won't slide either into a real HTML page even i called CSS and jquery : 即使我称之为CSS和jquery,它也不会滑入真正的HTML页面:

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" rel="stylesheet">
<link href="../css/slide-submit.css" rel="stylesheet">

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>

My final is to integrate this submit button into a Bootstrap4 webpage template. 我的最终目的是将此提交按钮集成到Bootstrap4网页模板中。

Many thanks for your help, 非常感谢您的帮助,

First, in JSfiddle example problem was with the links. 首先,在JSfiddle示例问题是链接。 Here (after few attempts) working example 这里(经过几次尝试)的工作实例

Second, or your website seems like you forgot to add slider handling code. 其次,或者您的网站似乎忘了添加滑块处理代码。 As you said, no errors in console, so I just tried to add code directly 正如你所说,控制台没有错误,所以我只是试图直接添加代码 在此输入图像描述

(Only this part above to see if it would change something) (上面只有这一部分,看它是否会改变一些东西)

    /*!
 * Slide to submit button
 */

 $(".slide-submit button").draggable({cancel: false, containment: "parent", axis: "x", stop: function() {
  if (($(this).parent().width() / 2) === ($(this).position().left + 8)) {
    $(this).css({left: "auto", right: 0}).addClass("submitted").text("Submitting...").draggable('false');
    $(this).closest("form").submit();
  } else {
    $(this).css({left: 0});
  }
}}).on("click", function() {
  return false;
});

And it looks like it worked out ( recorded animation here ) 它看起来很有效( 这里录制的动画

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM