查找索引/ie滤镜/动态背景/属性attr和prop

1. 查找索引

查找当前元素在指定范围内的索引序号,示例:

$('.right_newestState_con').find('em').index($(this));

2. ie滤镜

利用ie的私有滤镜让低版本ie浏览器支持一些高级效果

2.1 透明度

#myElement {
    opacity: .4; /* other browsers */
    filter: progid: DXImageTransform.Microsoft.Alpha( opacity=40 ); /* IE6, IE7, and IE8 */
    -ms-filter : "progid:DXImageTransform.Microsoft.Alpha( opacity=40 )"; /* IE8 only */
}

2.2 PNG图片透明度

.transparent{
	_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=img/nav_bg.png);
	_background:none;
}

2.3 阴影

.box-shadow {
    -moz-box-shadow: 2px 2px 3px #969696; /* Firefox */
    -webkit-box-shadow: 2px 2px 3px #969696; /* Safari and Chrome */
    filter: progid:DXImageTransform.Microsoft.Shadow( color='#969696', Direction=145, Strength=3 );
}

2.4 渐变

#gradient {
	background-image: -moz-linear-gradient( top, #81a8cb, #4477a1 ); /* Firefox 3.6 */
	background-image: -webkit-gradient(linear , left bottom , left top , color-stop( 0, #4477a1 ) , color-stop( 1, #81a8cb )); /* Safari & Chrome */
	filter:  progid:DXImageTransform.Microsoft.gradient( GradientType= 0 , startColorstr = '#81a8cb', endColorstr = '#4477a1' ); /* IE6 & IE7 */
	-ms-filter: "progid:DXImageTransform.Microsoft.gradient( GradientType = 0,startColorstr = '#81a8cb', endColorstr = '#4477a1' )"; /* IE8 */
}

2.5 背景色透明(RGBA)

#rgba p {
    background: rgba( 98, 135, 167, .4 );  /* other browsers */
    filter: progid:DXImageTransform.Microsoft.gradient( GradientType = 0,startColorstr = '#886287a7', endColorstr = '#886287a7' );  /* IE */
}

2.6 多背景

#multi-bg {
	 /* other browsers */
	background: url(images/bg-image-1.gif) center center no-repeat, url(images/bg-image-2.gif) top left repeat;
	/* IE */
    background: transparent url(images/bg-image-1.gif) top left repeat;
    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader (src = 'images/bg-image-2.gif', sizingMethod = 'crop'); /* IE6-8 */
    -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src = 'images/bg-image-2.gif', sizingMethod = 'crop')"; /* IE8 only */
}

2.7 旋转

#rotate {
    -webkit-transform: rotate(180deg); /* Safari and Chrome */
    -moz-transform: rotate(180deg); /* Firefox */
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation = 2); /* IE */
}

2.8 其他

3. 动态背景

//流动背景
var offsetbg = 0;
var windowWidth = Number($(window).width());
setInterval(function bg() {
    if (offsetbg >= windowWidth) {
        offsetbg = -windowWidth;
    }
    offsetbg += 10;
    $(".section_footer_flow").css("background-position-x", -offsetbg + "px")
}, 90 );

参考链接:jquery实现动态背景效果

4. 属性attr和prop

attr和prop的区别

参考链接:jQuery学习之prop和attr的区别

posted @ 2017-06-29 09:30  YSP易水寒  阅读(369)  评论(0编辑  收藏  举报