栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Tumblr样式的UserHoverCard

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Tumblr样式的UserHoverCard

本质上,我已经创建了一个非常聪明的解决方法。这是一个覆盖图像的遮罩(不可见),直到加载html,然后将z-index降低后才进行悬浮css。鼠标悬停在容器上。

小提琴

.summary {    margin: -50px auto 0;    width: 50px;    height: 50px;    position: relative;    z-index: 0;}.summary-mask {    margin: 50px auto 0;    width: 50px;    height: 50px;    position: relative;    z-index: 1;}.loaded .summary-mask {    z-index: -1;}

HTML

<div >    <div ></div>    <div  data-id="100"> <a href="http://kraigo.tumblr.com/" ></a>        <div ></div>    </div></div>

JS

var response = '<div > <div ></div> <div > <a href="http://kraigo.tumblr.com/" >Follow</a> <p > <a href="http://kraigo.tumblr.com/">Page Name</a> </p> </div> <div ></div> <div > <h1 >Username</h1> <p >Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy ..</p> </div> <ul > <li></li> <li></li> <li></li> </ul> </div>';$(document).ready(function () {    function showProfileTooltip(e, id) {        //send id & get info from get_profile.php         $.ajax({ url: '/echo/html/', data: {     html: response,     delay: 0 }, method: 'post', success: function (returnHtml) {     e.find('.user-container').html(returnHtml).promise().done(function () {         $('.the-container').addClass('loaded');     }); }        });    }    function hideProfileTooltip() {        $('.the-container').removeClass('loaded');    }    $('.the-container').hover(function (e) {        var id = $(this).find('.summary').attr('data-id');        showProfileTooltip($(this), id);    }, function () {        hideProfileTooltip();    });});


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/427348.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号