网站地图    收藏   

主页 > 前端 > css教程 >

鼠标划过div右上角显示删除叉,瀑布流效果 - htm

来源:自学PHP网    时间:2015-04-14 14:51 作者: 阅读:

[导读] 效果图:CSS样式:body{margin:0;padding:0;background:url( bg gif) 0 0 repeat f7f5f5;color: 333;font-family:Cambria, Georgia, serif;font-size:15px;overflow-x:hidden;}a {co...

效果图:

\

CSS样式:

body{
	margin:0;
	padding:0;
	background:url(../bg.gif) 0 0 repeat #f7f5f5;
	color:#333;
	font-family:Cambria, Georgia, serif;
	font-size:15px;
	overflow-x:hidden;
}


a {
	color:black;
	text-decoration:none;
}
a:hover, a:active{
	color:black;
}

/* clearfix */
.clearfix {
	clear:both;
}

/* container */
#container
{
	position:relative;
	width:1100px;
	margin:0 auto 25px;
	padding-bottom: 10px;
	
}



.grid{
	width:188px;
	min-height:100px;
	padding: 15px;
	background:#fff;
	margin:8px;
	font-size:12px;
	float:left;
	box-shadow: 0 1px 3px rgba(34,25,25,0.4);
	-moz-box-shadow: 0 1px 3px rgba(34,25,25,0.4);
	-webkit-box-shadow: 0 1px 3px rgba(34,25,25,0.4);
	
	-webkit-transition: top 1s ease, left 1s ease;
	-moz-transition: top 1s ease, left 1s ease;
	-o-transition: top 1s ease, left 1s ease;
	-ms-transition: top 1s ease, left 1s ease;
}

.border
{
   box-shadow: 2px 2px 3px  rgba(34,25,25,0.4) ;
	-moz-box-shadow: 2px 2px 3px  rgba(34,25,25,0.4) ;
	-webkit-box-shadow: 2px 2px 3px rgba(34,25,25,0.4) ;
  cursor:pointer;      
}


.grid .closeimg
{
    position : absolute;
	top : -25px;
	right : -16px;
	width : 50px;
	height : 50px;
	display:none;
}

.grid strong {
	border-bottom:1px solid #ccc;
	margin:10px 0;
	display:block;
	padding:0 0 5px;
	font-size:17px;
}
.grid .meta{
	text-align:right;
	color:#777;
	font-style:italic;
}
.grid .imgholder img{
	max-width:100%;
	background:#ccc;
	display:block;
}

HTML代码:

删除商品
日落湖

和平日落景观......

2013年6月6日
删除商品
天国的桥梁

桥在哪里?

by SigitEko


JS代码:

  <script type="text/javascript">
        $(document).ready(function () {



            //blocksit define
            $(window).load(function () {
                $('#container').BlocksIt({
                    numOfCol: 5,
                    offsetX: 8,
                    offsetY: 8
                });
            });

            //window resize
            var currentWidth = 1100;
            $(window).resize(function () {
                var winWidth = $(window).width();
                var conWidth;
                if (winWidth < 660) {
                    conWidth = 440;
                    col = 2
                } else if (winWidth < 880) {
                    conWidth = 660;
                    col = 3
                } else if (winWidth < 1100) {
                    conWidth = 880;
                    col = 4;
                } else {
                    conWidth = 1100;
                    col = 5;
                }

                if (conWidth != currentWidth) {
                    currentWidth = conWidth;
                    $('#container').width(conWidth);
                    $('#container').BlocksIt({
                        numOfCol: col,
                        offsetX: 8,
                        offsetY: 8
                    });
                }
            });

            //鼠标划过事件
            $(".grid").mouseover(function () {
                $(this).addClass("border");
                //显示删除叉
                $(this).find(".closeimg").css("display", "block");
            });
            $(".grid").mouseout(function () {
                $(this).removeClass("border");
                //隐藏删除叉
                $(this).find(".closeimg").css("display", "none");

            });
    });
    </script>

使用到图片:

img27.png

\


<喎"http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+aHR0cDovL3d3dy4yY3RvLmNvbS91cGxvYWRmaWxlLzIwMTQvMDEwOS8yMDE0MDEwOTExNTAxMjIzNi5wbmc8L3A+CjxwPjxpbWcgc3JjPQ=="http://www.2cto.com/uploadfile/Collfiles/20140109/20140109082546177.png" alt="\">



                    
                    

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论