gpt4 book ai didi

jquery - 显示图像的悬停工具提示

转载 作者:行者123 更新时间:2023-11-28 07:09:06 25 4
gpt4 key购买 nike

我试图在悬停时在工具提示中显示图像。我找到了这个很棒的解决方案,我只需要这样的东西:

Codepen

CSS:

@import "compass";

* {
box-sizing: border-box;
}

.tooltip {
position: relative;
border-bottom: 1px dotted #ccc;
cursor: help;

&:before, &:after {
@include single-transition($duration: .6s);
visibility: hidden;
}

&:before {
@include opacity(0);
position: absolute;
bottom: 0;
left: 50%;
margin-left: -6px;
content: '\00a0';
height: 0;
width: 0;
border-bottom: 6px solid #363636;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
}

&:after {
@include opacity(0);
@include border-radius(4px);
position: absolute;
content: attr(title);
top: 100%;
left: -12px;
width: 100%;
min-width: 120px;
margin: 0;
padding: 8px 10px;
background: #363636;
color: #fff;
font-size: 1.2rem;
font-weight: normal;
text-align: center;
}

&:hover {

&:after, &:before {
@include opacity(1);
visibility: visible;
}

&:before {
bottom: -6px;
}

&:after {
margin-top: 6px;
}
}
}

// Demo

html {
font-size: 62.25%;
}

body {
font-size: 1.6rem;
}

h1 {
font-size: 2.4rem;
}

.wrapper {
max-width: 32em;
padding: 12px;
margin: 0 auto;
font-family: sans-serif;
line-height: 1.4;
}

HTML:

<div class="wrapper">
<h1 class="tooltip" title="Tooltip">Pure CSS Tooltip</h1>
<p><span class="tooltip" title="I'm a Tooltip">Lorem ipsum dolor sit amet</span> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Numquam molestiae, quis accusamus fugiat officiis amet ullam, inventore vero! Officia iusto totam quis amet consequatur numquam nesciunt alias deleniti eos quas?<span class="tooltip" title="Another Tooltip">
Lorem ipsum</span> dolor sit amet, consectetur adipisicing elit. Beatae ut nihil labore at reiciendis placeat modi, Lorem ipsum dolor sit ameteum quia delectus similique accusamus sed soluta sunt aliquid repudiandae assumenda a illo molestiae.
<span class="tooltip" title="One more Tooltip">Lorem ipsum</span> dolor sit amet, consectetur adipisicing elit. Deserunt incidunt et earum repellendus, maxime neque voluptate molestias quod at illo maiores tempora suscipit, deleniti ipsum nesciunt, animi tempore, esse cum?
</p>
</div>

但问题是title 属性只能是text,而我需要显示image。这可以改变吗?如果可以,如何改变?或者有其他解决方案吗?

提前致谢。

PS:对不起,如果这听起来是个愚蠢的问题,这是我在 Stackoverflow 的第一个问题。

最佳答案

欢迎使用 Stackoverflow!不幸的是,没有机会将图像放入 title 属性。你应该使用像 jquery.ui 这样的 js 库。引用这个post .

关于jquery - 显示图像的悬停工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32778285/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com