滑鼠划過div右上方顯示刪除叉,瀑布流效果

來源:互聯網
上載者:User


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代碼:

<div id="container">        <div class="grid">            <img src="close_pop.png" class="closeimg" alt="刪除商品"  />            <div class="imgholder">                <img src="img27.jpg" width="175px" />            </div>            <strong>日落湖</strong>            <p>                和平日落景觀......</p>            <div class="meta">                2013年6月6日</div>        </div>        <div class="grid">         <img src="close_pop.png" class="closeimg" alt="刪除商品" width="80px" height="80px" />            <div class="imgholder">                <img src="img27.jpg" />            </div>            <strong>天國的橋樑</strong>            <p>                橋在哪裡?</p>            <div class="meta">                by SigitEko</div>        </div></div>


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


close_pop.png




相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.