有人可以解释一下为什么要更换以下内容
$('.post_title a').hover(function () {
$(this).parent().parent().parent().parent().find(".post_footer").toggleClass('footer_border')
});
Run Code Online (Sandbox Code Playgroud)
同
$('.post_title a').hover(function () {
$(this).closest(".post_footer").toggleClass('footer_border')
});
Run Code Online (Sandbox Code Playgroud)
不起作用?
<div class="modal hide" id="modalId">
<div class="modal-header" style="padding:30px 10px">
<h3 style="float:left">Some text here</h3>
<input type="image" src="image_path" alt="loading..." class="pull-right" />
</div>
<div class="modal-body" style="clear:both">
<!-- I have a table here-->
</div>
<div class="modal-footer">
<!-- I have a button here -->
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
将在按钮单击时调用的模态代码
$('#modalId').modal({
backdrop: 'static',
keyboard: false,
show: true
});
Run Code Online (Sandbox Code Playgroud)
这里我遇到的问题是,在模态弹出窗口中出现黑色窗口.
这在firefox,IE 8中完美运行,但在IE7中没有.
我尝试了很多,但在这里找不到问题.:(可以请一些人看看.thubjsdaps14
以下代码在播放器中加载youtubevidéo.
如果我删除了两个"警报",它就不再起作用了......
ytplayer = document.getElementById("ytPlayer");
alert('ok');
if (ytplayer) {
alert('ok');
loadVideo(url, start);
}
Run Code Online (Sandbox Code Playgroud)
有人能帮我吗?
我有一个像下面这样的域名.
我有两个子域,如下所示.
我想从foo.jayshit.info到bar.jayshit.info进行jQuery ajax调用以获取一些html或将一些数据更新回服务器.
我知道由于同样的原产地政策并不容易.我也不想使用JSONP.因为我希望我的ajax调用具有async:false如下所示.
$.ajax({
type: "POST",
cache: false,
url: tURL,
data: tData,
async: false
});
Run Code Online (Sandbox Code Playgroud)
如果有人遇到一些解决方法,请告诉我.
提前致谢.
问候,
下面,该功能适用于IE,这是好的,但我需要它在Chrome,FireFox等工作...在Chrome中我得到一个错误...继承我的代码
function loadList(list_name) {
var oList = context.get_web().get_lists().getByTitle(list_name);
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' + '<Value Type=\'Number\'>1</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
this.collListItem = oList.getItems(camlQuery);
Run Code Online (Sandbox Code Playgroud)
...它在Chrome中说.."未捕获的TypeError:无法设置未定义的属性'collListItem'..
我假设这是来自"这个"..铬如何处理'这'并且处理'这'是有区别的吗?
我该怎么办?谢谢!
我正在创建一个节点模块,我希望能够支持节点回调和Promise API.我听到最好的东西(主要是它最快)的图书馆是蓝鸟.所以在阅读了一些文档并查看其他一些使用bluebird的库之后,我认为这将是获得支持节点回调和Promise API的方法的最简洁方法:
this.isAllowed = function(role, resource, permission, callback) {
var isAllowedAsync = bluebird.promisify(isAllowed);
return isAllowedAsync(role, resource, permission).nodeify(callback);
};
Run Code Online (Sandbox Code Playgroud)
但是使用此代码,回调永远不会执行.经过一些研究,我尝试了这个:
this.isAllowed = function(role, resource, permission, callback) {
return new bluebird(function (resolve, reject) {
resolve(isAllowed(role, resource, permission));
}).nodeify(callback);
};
Run Code Online (Sandbox Code Playgroud)
使用该代码,节点回调和Promise API都可以工作.
作为参考,这是isAllowed方法:
var isAllowed = function(role, resource, permission) {
if(!lists[role] || !lists[role][resource]) {
return false;
}
return lists[role][resource].indexOf(permission) !== -1;
};
Run Code Online (Sandbox Code Playgroud)
我在第一个代码示例中做错了什么,或者第二个例子是获得我正在寻找的东西的真正方式?
我有问题,当我按下按钮时,我的javascript函数不是:
<script type="text/javascript" language="javascript">
(function ($) {
$.fn.addToList = function (opts) {
var input = $(this);
opts.button.click(function () {
opts.list.append("<li>" + input.val() + "</li>");
});
};
}(window.jQuery));
$("#zutat").addToList({
button: $("#btn"),
list: $("#list")
});
</script>
Run Code Online (Sandbox Code Playgroud)
和
<input type="text" id="zutat" name="zutat"></input>
<input type="button" id="btn" value="Click">
<ul id="list"></ul>
Run Code Online (Sandbox Code Playgroud)
我该如何调用这个javascript函数?我的问题是什么?
我真的是Javascript的初学者,并且尽可能多地尝试我所阅读的内容.
但是当谈到pop()并且push(),我得到一些我想知道的奇怪结果.
这是代码:
var arr = [];
arr.push(2,3);
console.log(arr);
console.log(arr.pop());
console.log(arr);
Run Code Online (Sandbox Code Playgroud)
结果是:
[2,undefined×1]
3
[2]
不应该是:
[2,3]
3
[2]
我想知道是否有可能使数字与目前使用JavaScript的数字相反.即如果是一个数字400.它是否有可能成功-400,如果数字是-400可能的话400呢?
javascript ×7
jquery ×3
ajax ×1
alert ×1
arrays ×1
bluebird ×1
closest ×1
csom ×1
html ×1
modal-dialog ×1
node.js ×1
promise ×1
sharepoint ×1