小编trs*_*trs的帖子

Dropzone.js - maxFiles = 1不会因拖动多个文件而停止

使用Dropzone.js,这是代码.选项"maxFiles = 1"确实会阻止在浏览时选择多个文件,但不会停止将多个文件"拖动"到dropzone区域.知道如何防止拖拽多个文件?

$(".dropzone").dropzone({
    dictDefaultMessage: "Drag image here",
    uploadMultiple: false,
    parallelUploads: 1,
    clickable: true,
    maxFiles: 1,
    url: 'somewhere' // Provide URL
});
Run Code Online (Sandbox Code Playgroud)

javascript forms jquery dropzone.js

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

将Google地图中心转到位置字符串

使用谷歌地图API,我想将地图居中一个字符串而不是Lat/Lng

var mapOptions = {
    center: "Paris"
};
Run Code Online (Sandbox Code Playgroud)

javascript google-maps geolocation google-maps-api-3

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

为什么 Angular 表单会重新加载页面?

我在同一页面上有以下表格:

<form ng-submit="actionA()">
    <input type="text">
    <input type="submit" value="Submit">
</form>

<form ng-submit="actionB()">
    <input type="text">
    <input type="submit" value="Submit">
</form>
Run Code Online (Sandbox Code Playgroud)

目前,当我提交任一表单时,页面会重新加载。我该如何防止?我知道我可以使用 event.preventDefault() 但我想知道是否有一个简单的 Angular 解决方案。

javascript jquery angularjs angularjs-ng-click ng-submit

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

如何使角遮罩与各种信用卡一起使用?

我在信用卡字段上使用 AngularUI Mask ( https://github.com/angular-ui/ui-mask )。

<input type="text" placeholder="xxxx-xxxx-xxxx-xxxx" ui-mask="9999-9999-9999-9999" ng-model="card.number">

但是,根据 Stripe ( https://stripe.com/docs/testing ) 的说法,并非所有卡片都有 16 位数字。如何允许用户输入 14 到 16 位数字并自动将其格式化为:

  • 美国运通的 xxxx-xxxxxx-xxxxx
  • xxxx-xxxx-xxxx-xx 用于 Diners Club
  • xxxx-xxxx-xxxx-xxxx 用于其他一切

Plnkr:http ://plnkr.co/edit/Qx9lv7t4jGDwtj8bvQSv?p=preview

javascript masking angularjs angular-ui

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

多个"InfoWindow"用于Google地图上的"标记"数组?

使用Google Maps API将infoWindow添加到每个标记.标记来自阵列.

虽然,infoWindow只显示第一个标记,而不显示其他标记.为什么?谢谢.

function set_markers(array) {
    var mapOptions = {
        zoom: 13
    }
    for (var i = 0; i < array.length; i++) {
        var single_location = array[i];
        var myLatLng = new google.maps.LatLng(single_location[1], single_location[2]);
        var marker = new google.maps.Marker({
            position: myLatLng,
            map: map,
            title: single_location[0]
        });
        var infowindow = new google.maps.InfoWindow({
            content: ""
        });
    }

    google.maps.event.addListener(marker, 'click', function() {
        infowindow.setContent('<h3>'+this.title+'</h3>');
        infowindow.open(map,this);
    });
}
Run Code Online (Sandbox Code Playgroud)

javascript maps google-maps google-maps-api-3

-1
推荐指数
1
解决办法
3329
查看次数