gpt4 book ai didi

jquery - 更改链接工具提示的类别

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

我有链接工具提示:

<a class="event color-red" href="#"><span>information</span>link</a>

如何改变它:

<a class="event" href="#"><span>information</span>link</a>

并保持tooltip效果。

这实际上是我的代码,JavaScript 代码是我的,但是 css 是从互联网上提取的:

$(document).ready(function() {
$('event color-red').hide();
});

$(function() {
$(".event color-red").click(function() {
$('event color-red').fadeIn();
var commentContainer = $(this).parent();
var id = $(this).attr("id");

alert("The value is "+id);

return false;
});
});
 .event,
.cancel,
.music,
.subtitle
{
position: relative !important;
display: inline-block !important;
text-decoration: none !important;
}

.event span,
.cancel span,
.music span,
.subtitle span,
.css-tooltip-diagonal-right span,
.css-tooltip-diagonal-left span
{
min-width: 180px;
font-family: arial, sans-serif !important;
font-size: 13px !important;
line-height: normal !important;
text-align: left !important;
padding: 10px 10px 12px 10px !important;
visibility: hidden;
opacity: 0;
position: absolute;
z-index: 9999999 !important;

-webkit-transition-duration: 0.25s;
-moz-transition-duration: 0.25s;
-o-transition-duration: 0.25s;
-ms-transition-duration: 0.25s;
transition-duration: 0.25s;
-webkit-transition-timing-function: cubic-bezier(0.35,0,0.35,1);
-moz-transition-timing-function: cubic-bezier(0.35,0,0.35,1);
-o-transition-timing-function: cubic-bezier(0.35,0,0.35,1);
-ms-transition-timing-function: cubic-bezier(0.35,0,0.35,1);
transition-timing-function: cubic-bezier(0.35,0,0.35,1);
}

.event span:before,
.cancel span:before,
.music span:before,
.subtitle span:before,
.css-tooltip-diagonal-right span:before,
.css-tooltip-diagonal-left span:before
{
content: "";
display: block;
width: 0px;
height: 0px;
position: absolute;
}

/* Tool tip Top */
.event span
{
left: -10px;
bottom: 100%;
margin-bottom: 30px;

-webkit-transition-property: opacity, margin-bottom, visibility;
-moz-transition-property: opacity, margin-bottom, visibility;
-o-transition-property: opacity, margin-bottom, visibility;
-ms-transition-property: opacity, margin-bottom, visibility;
transition-property: opacity, margin-bottom, visibility;
}

.event span:before
{
border-left: 8px solid transparent !important;
border-right: 8px solid transparent !important;
border-top: 8px solid #000;
border-bottom: 0 !important;
bottom: -8px;
left: 15px;
}

.event:hover span
{
margin-bottom: 10px; /* End Position */
visibility: visible;
opacity: 1;
}


/* tooltip left
-------------------------------------------------------------- */

.subtitle span
{
right: 100%;
top: -7px;
margin-right: 35px;

-webkit-transition-property: opacity, margin-right, visibility;
-moz-transition-property: opacity, margin-right, visibility;
-o-transition-property: opacity, margin-right, visibility;
-ms-transition-property: opacity, margin-right, visibility;
transition-property: opacity, margin-right, visibility;
}

.subtitle span:before
{
border-left: 8px solid #000;
border-right: 0 !important;
border-top: 8px solid transparent !important;
border-bottom: 8px solid transparent !important;
top: 11px;
right: -8px;
}

.subtitle:hover span
{
margin-right: 15px;
visibility: visible;
opacity: 1;
}

/* tooltip right
-------------------------------------------------------------- */

.music span
{
left: 100%;
top: -7px;
margin-left: 35px;

-webkit-transition-property: opacity, margin-left, visibility;
-moz-transition-property: opacity, margin-left, visibility;
-o-transition-property: opacity, margin-left, visibility;
-ms-transition-property: opacity, margin-left, visibility;
transition-property: opacity, margin-left, visibility;
}

.music span:before {
border-left: 0 !important;
border-right: 8px solid #000;
border-top: 8px solid transparent !important;
border-bottom: 8px solid transparent !important;
top: 11px;
left: -8px;
}

.music:hover span
{
margin-left: 15px;
visibility: visible;
opacity: 1;
}


/*tooltip bottom
-------------------------------------------------------------- */

.cancel span
{
left: -10px;
top: 100%;
margin-top: 30px;

-webkit-transition-property: opacity, margin-top, visibility;
-moz-transition-property: opacity, margin-top, visibility;
-o-transition-property: opacity, margin-top, visibility;
-ms-transition-property: opacity, margin-top, visibility;
transition-property: opacity, margin-top, visibility;
}

.cancel span:before
{
border-left: 8px solid transparent !important;
border-right: 8px solid transparent !important;
border-top: 0 !important;
border-bottom: 8px solid #000;
top: -8px;
left: 15px;
}

.cancel:hover span
{
margin-top: 10px;
visibility: visible;
opacity: 1;
}

/* Tooltip Color */
.color-blue span
{
color: #ffffff !important;

background: rgba(0,0,0,0.75);
background: -moz-linear-gradient(top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.75) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.75)), color-stop(100%,rgba(0,0,0,0.75)));
background: -webkit-linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);
background: -o-linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);
background: -ms-linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);
background: linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);

-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;

text-shadow: 0px 1px 0px rgba(0,0,0,0.4);
}

.color-blue span:before
{
border-color: rgba(0,0,0,0.75);
}

.color-blue span:after
{
content: "";
display: block;
border-top: 1px solid rgba(0,0,0,0.75);
position: absolute;
left: 0px;
top: 1px;
width: 100%;
height: 10px;

-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}

.color-green span
{
color: #ffffff !important;


background: rgba(0,0,0,0.75);
background: -moz-linear-gradient(top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.75) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.75)), color-stop(100%,rgba(0,0,0,0.75)));
background: -webkit-linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);
background: -o-linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);
background: -ms-linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);
background: linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);

-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;


text-shadow: 0px 1px 0px rgba(0,0,0,0.4);
}


.color-green span:before
{
border-color: rgba(0,0,0,0.75);
}


.color-green span:after
{
content: "";
display: block;
border-top: 1px solid rgba(0,0,0,0.75);
position: absolute;
left: 0px;
top: 1px;
width: 100%;
height: 10px;


-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}


.color-green span strong
{
background: #246407;
border-bottom: 1px solid #205a06;
}

/*orange*/

.color-orange span
{
color: #ffffff !important;


background: rgba(0,0,0,0.75);
background: -moz-linear-gradient(top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.75) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.75)), color-stop(100%,rgba(0,0,0,0.75)));
background: -webkit-linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);
background: -o-linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);
background: -ms-linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);
background: linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);

-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;


text-shadow: 0px 1px 0px rgba(0,0,0,0.4);
}


.color-orange span:before
{
border-color: rgba(0,0,0,0.75);
}


.color-orange span:after
{
content: "";
display: block;
border-top: 1px solid rgba(0,0,0,0.75);
position: absolute;
left: 0px;
top: 1px;
width: 100%;
height: 10px;


-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}


.color-orange span strong
{
background: #bf461a;
border-bottom: 1px solid #ac3f17;
}

/*red*/

.color-red span
{
color: #ffffff !important;
background: rgba(0,0,0,0.75);
background: -moz-linear-gradient(top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.75) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.75)), color-stop(100%,rgba(0,0,0,0.75)));
background: -webkit-linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);
background: -o-linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);
background: -ms-linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);
background: linear-gradient(top, rgba(0,0,0,0.75) 0%,rgba(0,0,0,0.75) 100%);
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
text-shadow: 0px 1px 0px rgba(0,0,0,0.4);
}
.color-red span:before
{
border-color: rgba(0,0,0,0.75);
}
.color-red span:after
{
content: "";
display: block;
border-top: 1px solid rgba(0,0,0,0.75);
position: absolute;
left: 0px;
top: 1px;
width: 100%;
height: 10px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.color-red span strong
{
background: rgba(0,0,0,0.75);
border-bottom: 1px solid rgba(0,0,0,0.75);
}
<br><br><br><br>


<a class='event color-red' href="#" id="1"><span>informação</span>link</a>

我不知道解决了这个问题。

拜托,有人可以帮忙吗?

其实对css不是很懂。

非常感谢!

最佳答案

您的代码 ($(".event color-red")) 实际上是在类名为 的元素内部选择类名为 color-red 的元素>事件(这与您的描述不同。)

但是,如果您想淡入 .event anchor 内的span 元素,您可以使用$(".event") 选择器来绑定(bind)点击事件,并在其中使用 $(this).find('> span') 作为选择器来获取 span 元素并使用 .fadeIn()

让它淡入

所以代码看起来像这样:

$(document).ready(function() {
$('.event > span').hide(); // Get the direct descendant of all elements with classname 'event'
});

$(function() {
// Bind the click event to the anchors with classname 'event'
$(".event").click(function( ev ) {

ev.preventDefault();

// Fade in the SPAN inside the anchor
$(this).find('> span').fadeIn();

});
});

重要说明:选择器要准确无误,请查看:jQuery's documentation on this

关于jquery - 更改链接工具提示的类别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36292647/

25 4 0
文章推荐: html - 将 div 定位在 “absolute”
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com