小编Aru*_*R S的帖子

javascript:如何中止$ .post()

我有post方法,如下所示:

$(".buttons").click(function(){
  var gettopic=$.post("topic.php", {id: topicId}, function(result){
  // codes for handling returned result

  });
})
Run Code Online (Sandbox Code Playgroud)

当点击一个新按钮时,我试图中止旧帖子:所以我很累

$(".buttons").click(function(){
    if (gettopic) {
        gettopic.abort();
    }
    var gettopic=$.post("topic.php", {id: topicId}, function(result){
         // codes for handling returned result
    });
})
Run Code Online (Sandbox Code Playgroud)

但这不起作用.所以我想知道如何解决这个问题?

html javascript ajax jquery

7
推荐指数
1
解决办法
2799
查看次数

角度材料datepicker组件不起作用

我正在学习angularjs并使用angularjs材料datepicker组件进行日期控制,但它不起作用,我使用的材料与material.angularjs.org中的相同,但我的控件没有显示请帮助.我的html页面是DatePicker.html:

  <!DOCTYPE html>
    <html ng-app="datepickerBasicUsage">

    <head>
        <title></title>
        <link href="angular-material.min.css" rel="stylesheet" />
        <script src="angular.min.js"></script>
        <script src="angular-animate.min.js"></script>
        <script src="angular-aria.min.js"></script>
        <script src="angular-material.min.js"></script>

        <script src="myapp.js"></script>
    </head>

    <body>
        <div ng-controller="AppCtrl" style='padding: 40px;'>
            <md-content>
                <h4>Standard date-picker</h4>
                <md-datepicker ng-model="myDate" md-placeholder="Enter date"></md-datepicker>
                <h4>Disabled date-picker</h4>
                <md-datepicker ng-model="myDate" placeholder="Enter date" disabled></md-datepicker>
                <h4>Date-picker with min date and max date</h4>
                <md-datepicker ng-model="myDate" placeholder="Enter date" md-min-date="minDate" md-max-date="maxDate"></md-datepicker>
            </md-content>
        </div>
    </body>

</html>
Run Code Online (Sandbox Code Playgroud)

myapp.js

angular.module('datepickerBasicUsage', ['ngMaterial'])
.controller('AppCtrl', function($scope) {
    $scope.myDate = new Date();
    $scope.minDate = new Date(
        $scope.myDate.getFullYear(),
        $scope.myDate.getMonth() - 2,
        $scope.myDate.getDate());
    $scope.maxDate = new …
Run Code Online (Sandbox Code Playgroud)

datepicker angularjs

6
推荐指数
1
解决办法
2万
查看次数

在 Firefox 和 Edge 中隐藏滚动条

是否有任何 Javascript/Jquery 插件或 css 技巧可用于隐藏 Firefox/Edge(本机滚动条)中的滚动条?即,我必须滚动该区域,但是滚动条不应该可见。

html javascript css jquery

5
推荐指数
1
解决办法
6967
查看次数

if语句添加使用`is-inactive`类的玩家输入的问题

问题

每个职位的最大玩家人数为:

  • 4个守门员中有2个
  • 15名防守队员中有6名
  • 31个前锋中的12个

我已经达到了点击曲棍球运动员的地步,并且该名称被添加到表格中的输入字段,但是如果你已经选择了两个守门员,即有一个类,is-active然后点击其中一个其他两个具有默认is-inactive类的未选择的玩家,当最多只有两个守门员时,该名称仍会被添加到输入中.不幸的是,防守队员和前锋也是如此.

目标

当starredGoaltenders === maxGoaltenders或者starredDefencemen === maxDefencemen或starredForwards === maxFowards那的球员的名字不未被选择的特定位置,并且不具有is-active类不应该被添加到表单中任何输入.

scripts.js中

    function countSelected() {
        $(".player").on("click", function(){

            // Checks if the maximum number of players have been selected
            // If so, return false and then do nothing
            // If not, the class will toggle from `is-inactive` to `is-active`
            if ($(this).find(".picked.is-inactive.full").length > 0) return false;
            $(this).find(".picked").toggleClass("is-inactive is-active");
            $(".player").removeClass("not-picked");
            $(".player").not(":has(.is-active)").addClass("not-picked");

            // Count the …
Run Code Online (Sandbox Code Playgroud)

javascript forms jquery if-statement input

5
推荐指数
1
解决办法
177
查看次数

jquery插件Pace.js无法正常工作

我正在使用jquery插件pace.js,我希望当页面加载时,首先加载进度条,然后显示内容,这是我的代码

<div class="pace  pace-inactive">
    <div class="pace-progress" data-progress-text="100%" data-progress="99" style="width: 100%;">
        <div class="pace-progress-inner"></div>
    </div>
    <div class="pace-activity"></div>
</div>
Run Code Online (Sandbox Code Playgroud)

在的jsfiddle将定义我的工作的结果.

在我的情况下,内容和进度条都会同时显示.

我想要的是:我希望首先显示进度条,进度条符号后,内容将像本网站一样显示.

更新:

这是我接下来尝试但当进度完成时它不会显示任何内容......

<!doctype html>
<html lang="en">
   <head>
      <meta charset="UTF-8">
      <title>bk</title>
      <link rel="stylesheet" href="css/pace-atom.css"/>
      <style>
         #contents {
             display: none;
         }
         .cover {
             position: fixed;
             left: 0px;
             top: 0px;
             width: 100%;
             height: 100%;
             z-index: 1999;
             background:rgb(33,33,33);
         }
      </style>
   </head>
   <body class="pace-done">
      <div class="pace  pace-inactive">
         <div class="pace-progress" data-progress-text="100%" data-progress="99" style="width: 100%;">
            <div class="pace-progress-inner"></div>
         </div>
         <div class="pace-activity"></div>
      </div>
      <div>
         <div …
Run Code Online (Sandbox Code Playgroud)

javascript jquery plugins

3
推荐指数
1
解决办法
8044
查看次数

离子降低滚动速度

我试图减慢此代码的滚动时遇到问题:

$ionicScrollDelegate.$getByHandle('credit').scrollBottom(true). 
Run Code Online (Sandbox Code Playgroud)

如何减慢滚动速度?因为现在滚动速度太快了.我需要放慢滚动速度,就像星球大战电影中的信用场景一样.

非常感谢Anyhelp,谢谢!

$scope.viewCreditsV2 = function () {
    $ionicModal.fromTemplateUrl('views/popupcredit.html', {
        scope: $scope,
        animation: 'slide-in-up'
    }).then(function(modal) {
            $scope.modal = modal;
            $scope.modal.show();
            if ($scope.modal.isShown()){                               
                setTimeout(function() {
                      // Do something after 2 seconds
                     $ionicScrollDelegate.$getByHandle('credit').scrollBottom(true);
                }, 2000);
            }
        });

    $scope.openModal = function() {
        $scope.modal.show();
    };
    $scope.closeModal = function() {
        // $scope.modal.hide();
        $scope.modal.remove();
    };
};
Run Code Online (Sandbox Code Playgroud)

ionic-framework

3
推荐指数
1
解决办法
2960
查看次数