我在bootstrap模式中有一个select2框,我想更改select2框的值,但它不起作用.
我在以前的帖子和结果中尝试过每一个解决方案,但没有一个能让它发挥作用.
我使用select2 4.0.2,我测试过:
$('#select_id').val('val').trigger('change.select2');
$('#select_id').val('val').trigger('change');
$('#select_id').val('val').change()
Run Code Online (Sandbox Code Playgroud)
它工作一到两次然后停止工作(随机)
只有当我将select2更改回3.xx时,它才能正常工作
我发现了的WebPack的选项的说明LimitChunkCountPlugin,MinChunkSizePlugin以及AggressiveMergingPlugin是有点混乱.有些是不言自明的,但有些是非常模糊的.
在LimitChunkCountPlugin中,我提供了3个选项:
options.maxChunks(数量)最大块数
options.chunkOverhead(number)每个块的额外开销(以字节为单位)(默认为10000,以反映请求延迟)
options.entryChunkMultiplicator(数字)一个用于输入块的乘数(默认值为10,输入块的合并次数减少10倍)
maxChunks非常明显chunkOverhead是什么声音它会向块中添加10,000个空字节来反映一个delay??? 这毫无意义entryChunkMultiplicator不是那么模糊,但仍然很模糊.我猜是一个抽象数字,其中越高的条目块(在我的情况下只有1个条目块)将被合并到另一个块中的可能性越小在MinChunkSizePlugin中,我提供了一个选项
合并低于此最小尺寸的小块(以字符为单位).尺寸近似.
options.minChunkSize(数字)将合并小于此数字的块
所以char有多大,ascii char是1字节但是utf-8和utf-16最多可以是2个字节(如果我是正确的话).我猜我们将使用1-char到1-byte,在这种情况下,1024例如是1kb.其他人使用什么价值?
对于AggressiveMergingPlugin
options.minSizeReduce定义块合并所需的最小尺寸减少的因素.默认为1.5,这意味着对于块合并,总大小需要减少50%.
options.moveToParents设置后,不在两个合并块中的模块将移动到块的所有父项.默认为false.
options.entryChunkMultiplicator设置options.moveToParents时,移动到条目块会更昂贵.默认为10,这意味着移动到条目块比移动到正常块大十倍.
minSizeReduce 非常简单,如果块可以缩小50%或更多合并它moveToParents这也很令人困惑,默认情况下设置为false会抛出红色标记,也许我不应该触摸它,但听起来它重复并将所有未共享模块移动到所有父级.如果是这样,为什么有人会使用该选项.entryChunkMultiplicator这是非常抽象和模糊的,听起来,当模块被移动到一个入口块时,它的访问速度要慢10倍,这是不对的.我为什么要慢一点?如果有人能提前为我解决这个问题.
我正在尝试使用jsPDF将应用程序导出为PDF.在浏览网页后,在这里抓取一行代码,在那里找到一个部分 - 我已经设法让它工作...... 有点.
它适用于Firefox和Safari,但不适用于Chrome.
使用的JS文件(来自jsPDF).也许是矫枉过正.和Jquery一起.
<script type="text/javascript" src="PDF/standard_fonts_metrics.js"></script>
<script type="text/javascript" src="PDF/split_text_to_size.js"></script>
<script type="text/javascript" src="PDF/from_html.js"></script>
<script type="text/javascript" src="PDF/addhtml.js"></script>
<script type="text/javascript" src="PDF/addimage.js"></script>
Run Code Online (Sandbox Code Playgroud)
我正在使用的代码是这样的:
<script type="text/javascript">
function demoFromHTML() {
$('#listAreaPDF').css("display", "block");
var pdf = new jsPDF('p', 'pt', 'letter');
// source can be HTML-formatted string, or a reference
// to an actual DOM element from which the text will be scraped.
source = $('#listAreaPDF')[0];
pdf.setFontSize(24);
pdf.text(35, 40, "PDF Title here");
pdf.setFontSize(10);
pdf.text(500, 40, "Company Name AB");
// we support special element …Run Code Online (Sandbox Code Playgroud) 我正在研究Cordova应用程序.我在哪里连接到实时传感器并从传感器读取一些数据.问题是当我滚动视图时数据被加扰.这适用于Android但不适用于iOS.
这是我的代码片段.
<div id="right_col">
<button onclick="clearReceivedData()">Clear Received Data</button>
<br>
<div id="receivedData"></div>
</div>
function dataReceivedCallback(data) {
document.getElementById("receivedData").innerHTML += data.value1 + ": ";
document.getElementById("receivedData").innerHTML += data.value2 + ":";
document.getElementById("receivedData").innerHTML += data.value3 + "<br>";
}
Run Code Online (Sandbox Code Playgroud)
dataReceivedCallback将从传感器接收的每个数据调用.此回调也会阻塞,直到滚动完成.如何在滚动UI时更新UI.
在jsp页面中,我<s:optiontransferselect>在左侧和右侧之间有一个交换值和一个保存的提交按钮.
<s:optiontransferselect
allowUpDownOnLeft="false"
allowUpDownOnRight="false"
allowSelectAll="false"
allowAddAllToLeft="false"
allowAddAllToRight="false"
addToRightLabel="Go to right"
addToLeftLabel="Go to left"
leftTitle="Left side values"
headerKey="0"
name="option"
list= "optionList"
rightTitle="Right side values"
doubleHeaderKey="0"
doubleList="selectedOptionList"
doubleName="selectOption"
doubleId="selectedValues"
>
</s:optiontransferselect>
<s:submit />
Run Code Online (Sandbox Code Playgroud)
我运行程序,它实际上可以从右侧保存值.但是它没有显示保存的值.
我正在考虑使用javascript并使用onchange事件<s:optiontransferselect>来实现这一目标
<script>
function show(){
var list = document.getElementById("selectedValues");
for (var i = 0; i < list.options.length; i++) {
//seems something not correct in this part but I am not sure how solve in this way
list.options[i].selected = true;
}
return true;
} …Run Code Online (Sandbox Code Playgroud) 我正在测试以下示例,通过登录并重定向到auth屏幕来验证用户身份 - http://jsfiddle.net/JMPerez/j1sqq4g0/
此示例使用带有以下脚本的回调页面:
(function() {
var hash = {};
window.location.hash.replace(/^#\/?/, '').split('&').forEach(function(kv) {
var spl = kv.indexOf('=');
if (spl != -1) {
hash[kv.substring(0, spl)] = decodeURIComponent(kv.substring(spl+1));
}
});
console.log('initial hash', hash);
if (hash.access_token) {
window.opener.postMessage(
JSON.stringify({
type:'access_token',
access_token: hash.access_token,
expires_in: hash.expires_in || 0
}),
'http://fiddle.jshell.net'
);
window.close();
}
})();
Run Code Online (Sandbox Code Playgroud)
在手机上试用时,它会在Safari中打开一个新标签.是否可以检查应用程序是否安装在iOS上并通过它登录?将使这个过程更快.
正如在这里的一个问题中看到的那样,它似乎已经解决但却无法理解触发它的原因是什么?- https://github.com/spotify/web-api/issues/718
谢谢!
我正在尝试为我的应用程序实现桌面通知.如果发送一个通知,它工作正常,但是当同时发送多个通知时,firefox不会显示任何通知.Chrome不存在此问题.
这是用firefox无法实现的吗?我的印象是,通知选项中的标签用法用于堆叠通知.
码:
function isNewNotificationSupported() {
if (!window.Notification || !Notification.requestPermission) return false;
if (Notification.permission == "granted") throw new Error("");
try {
new Notification("");
} catch (e) {
if (e.name == "TypeError") return false;
}
return true;
}
function notifyMe(aa, bb, cc, dd) {
if (!("Notification" in window)) {
//alert("This browser does not support desktop notification");
} else if (Notification.permission === "granted") {
if (!document.hasFocus() || cc == 1) {
var options = {
body: bb,
icon: "",
dir: "ltr",
tag: …Run Code Online (Sandbox Code Playgroud) 我正在使用system.js和systemjs builder来创建一个dist文件夹,其中包含我的angular2应用程序的所有打包的javascript文件.
它工作得非常好,除了它不包括以下文件,这些文件目前静态包含在index.html中:
如何强制systemjs构建器包含这些依赖项?
库-bundle.js:
var SystemBuilder = require('systemjs-builder');
var builder = new SystemBuilder();
builder.loadConfig('./systemjs.config.js').then(function() {
return builder.bundle(
'app - [app/**/*]', // build app and remove the app code - this leaves only 3rd party dependencies
'dist/libs-bundle.js'
);
}).then(function() {
console.log('library bundles built successfully!');
});
Run Code Online (Sandbox Code Playgroud)
APP-bundle.js
var SystemBuilder = require('systemjs-builder');
var builder = new SystemBuilder();
builder.loadConfig('./systemjs.config.js').then(function() {
return builder.bundle(
'app - dist/libs-bundle.js', // build the app only, exclude everything already included in …Run Code Online (Sandbox Code Playgroud) 我正在使用AngularJs作为前端和Laravel作为后端的Web应用程序
在许多视图中,我与tweet按钮共享栏,我设法使用twitter javascript小部件添加共享按钮
twttr.widgets.createShareButton(
'https://dev.twitter.com/',
document.getElementById('tw'),
{
count: 'none',
text: 'Sharing a URL using the Tweet Button'
}
).then(function (el) {
console.log("Button created.", el);
});
Run Code Online (Sandbox Code Playgroud)
并且我设法通过此Twitter分享按钮检测到点击事件
twttr.events.bind(
'tweet',
function (event) {
console.log('tweeet', event);
}
);
Run Code Online (Sandbox Code Playgroud)
但如果用户点击推文按钮即使他刚刚关闭弹出窗口并且没有发推文,这个事件就会触发!
我在Twitter社区找到了这个帖子https://twittercommunity.com/t/need-to-check-if-user-tweet-like-retweet-post-successfully-using-js-intent/61432但是从2月开始,2015年我希望在一年多之后有新的东西!
无论如何跟踪一个完整的成功推文!
提前致谢.
我正在尝试编写一些简单的Javascript,它使用Trello API从我的帐户获取所有板/列表/卡并将它们添加到可排序的表中(使用Datatables jquery插件).
到目前为止,我设法编写了一个获取所有这些信息并将其写入页面的jsfiddle,但我无法弄清楚如何将所有这些信息存储到某种数据结构中,然后可以将其传递给datatable插件.
到目前为止,这是从Trello获取数据的小提琴:
var carddata = [];
Trello.members.get("me", function(member) {
$("#fullName").text(member.fullName);
var boardUrl = "";
boardUrl = "members/me/boards";
Trello.get(boardUrl, function(boards) {
$.each(boards, function(ix, board) {
Trello.get("/boards/" + board.id + "/lists", function(lists) {
$.each(lists, function(ix, list) {
Trello.get("lists/" + list.id + "/cards", function(cards) {
$.each(cards, function(ix, card) {
console.log("boardname: " + board.name + "; list name: " + list.name + "; card name: " + card.name);
carddata.push(
"boardname: " + board.name +
"; list name: " …Run Code Online (Sandbox Code Playgroud)