jQuery :not() Selector iOS5 compatible?
jQuery :not() Selector iOS5 compatible?
我在客户端wordpress博客中使用以下jQuery块:
jQuery(this)
.children(":not('.previewTitle, .previewBody')")
.fadeTo(fadeTime, activeOpacity, function(){
//some code
});
这段代码淡化了父容器(this),但不会像我希望的那样淡化.previewTitle
和.previewBody
的两个内部容器。此代码适用于除iOS (5) Safari以外的所有主要浏览器版本 - 有人知道为什么iOS对我有牛肉吗?
谢谢!
编辑:我检查了几次你的测试代码,但我真的看不出有什么区别。这是我的完整代码:
jQuery(thumbs).hover(
function(){
jQuery(this).children(":not(.previewTitle, .previewBody)").fadeTo(fadeTime, activeOpacity, function(){
//Display Preview Body once faded in
strId = jQuery(this).closest('div').attr('id'); //Get parent DIV ID
jQuery('#previewTitle' + strId.substr(9)).show();
jQuery('#previewBody' + strId.substr(9)).show();
});
},
function(){
// Only fade out if the user hasn't clicked the thumb
if(!jQuery(this).hasClass(clickedClass))
{
//Fade out of thumbnail..
jQuery(this).children(":not(.previewTitle, .previewBody)").fadeTo(fadeTime, inactiveOpacity, function(){
//Hide Preview Body once faded out
strId = jQuery(this).closest('div').attr('id'); //Get parent DIV ID
jQuery('#previewTitle' + strId.substr(9)).hide();
jQuery('#previewBody' + strId.substr(9)).hide();
});
}
});
你不会把参数放在引号里:not
,只是:
jQuery(this).children(":not(.previewTitle, .previewBody)").fadeTo(....
// no quote ----^ no quote ----^
:not
接受选择器,而不是字符串。我很好奇它适用于其他带有引号的浏览器......
除此之外,它应该可以工作。它在iOS 4.3.2(我妻子的iPad)上对我有用:实时副本|源
.HTML:
<p>Click anywhere in the shaded container:</p>
<div id="container">
<p>Child that will fade</p>
<p>Another that will fade</p>
<p class="previewTitle">previewTitle - won't fade</p>
<p>Another that will</p>
<p class="previewBody">previewBody - won't fade</p>
<p>Another that will</p>
</div>
JavaScript:
jQuery(function($) {
$("#container").click(function() {
$(this)
.children(":not('.previewTitle, .previewBody')")
.fadeTo("slow", "0.2");
});
});
。但我没有方便测试的iOS 5。
旁注:
这段代码淡化了父容器(this),但不会像我希望的那样淡化
.previewTitle
和.previewBody
的两个内部容器。
您引用的代码根本不会淡化父容器。它会淡化除列出的两个子项之外的所有子项。那不是一回事。
相关文章:
- jquery window.load()函数赢得't在ios5上触发
- iOS5 Doesn't Support bind()!
- Angular JS App ng-href compatible for Web and Phonegap / Cor
- X-UA-Compatible 在 ShowModalDialog 启动页面时被忽略
- 禁用 iOS5.1 Webapp 反弹而不禁用滚动
- jQuery :not() Selector iOS5 compatible?
- 功能无法按ios5 iPad的正确顺序工作
- jqgrid compatible with jquery.mobile-1.0rc2
- iOS4中的像素化,而不是iOS5
- iOS5 Mobile Safari:使用语音助手处理HTML输入文本上下键
- Making Loopback API Ember.js compatible
- Are canvas.toDataURL compatible with PHP's base64_decode
- 防止在ios5移动浏览器中拖动窗口
- 如何在ios5中获得UIwebView's JSContext
- jQuery雪花插件在iOS5上崩溃
- & # 39;未定义# 39;在ios5中未定义
- AngularJS 1.2.21 forEach is not compatible with ng-grid?
- 在iOS5/phonegap上上传图片.可能的字节数组/数据URI
- javascript函数srcElement.nodeName在iOS5中给出错误的输出
- iOS5 Safari:键盘不会隐藏在主屏幕的HTML应用程序中