Javascript jQuery/CSS-:是否在关闭时启用悬停?
我的网站有一个名为Noty的jQuery插件, 这是一个很小的通知窗口。 它显示在我的标题下,但是标题有一个:hover伪类, 这使得它向下展开,留下noty(它告诉您将鼠标悬停在页眉上) 最重要的是,看起来一团糟 解决方案可以是添加´.header:hover´,或者将´.header´更改为类似于´.headerhover´的内容,这将与伪类´.headerhover:hover´相关 我已经试过了,但最终结果是整个头球都被撞坏了 jQuery/JavaScript:Javascript jQuery/CSS-:是否在关闭时启用悬停?,javascript,jquery,css,hover,Javascript,Jquery,Css,Hover,我的网站有一个名为Noty的jQuery插件, 这是一个很小的通知窗口。 它显示在我的标题下,但是标题有一个:hover伪类, 这使得它向下展开,留下noty(它告诉您将鼠标悬停在页眉上) 最重要的是,看起来一团糟 解决方案可以是添加´.header:hover´,或者将´.header´更改为类似于´.headerhover´的内容,这将与伪类´.headerhover:hover´相关 我已经试过了,但最终结果是整个头球都被撞坏了 jQuery/JavaScript: 请详细回答,这样我才能
请详细回答,这样我才能学习。那么…你的问题是什么?我如何才能让它工作?只有你准确地描述你的问题,我们才能给出详细的答案。简而言之:当我做“onshow、aftershow等”时,它将无法正常工作,并使我的header div崩溃。它应该可以工作:当Noty关闭时,启用header:hover。
function generate(layout) {
var n = noty({
text: layout,
type: 'information',
text: 'Change your language here! Dismiss this by clicking.',
dismissQueue: true,
layout: layout,
theme: 'defaultTheme'
});
console.log('html: ' + n.options.id);
}
function generateAll() {
generate('top');
generate('topCenter');
}
$(document).ready(function () {
generateAll();
});
$.noty.top = {
layout: 'top',
theme: 'defaultTheme',
type: 'information',
text: '',
dismissQueue: true, // If you want to use queue feature set this true
template: '<div class="noty_message"><span class="noty_text"></span><div class="noty_close"></div></div>',
animation: {
open: {
height: 'toggle'
},
close: {
height: 'toggle'
},
easing: 'swing',
speed: 500 // opening & closing animation speed
},
timeout: 500, // delay for closing event. Set false for sticky notifications
force: false, // adds notification to the beginning of queue when set to true
modal: false,
maxVisible: 5, // you can set max visible notification for dismissQueue true option
closeWith: ['click'], // ['click', 'button', 'hover']
callback: {
onShow: function () {
$(".header").removeClass("enabled");
},
afterShow: function () {
$(".header").removeClass("enabled");
},
onClose: function () {
$(".header").addClass("enabled");
},
afterClose: function () {
$ ".header").addClass("enabled");
}
},
buttons: false // an array of buttons
};
.header {
overflow: hidden;
background:#FFF;
border-bottom:1px solid gray;
box-shadow:0 0 10px;
height:70px;
position:fixed;
top:0px;
width:100%;
z-index:2;
background: rgb(210, 255, 82);
/* Old browsers */
background: -moz-linear-gradient(top, rgba(210, 255, 82, 1) 0%, rgba(145, 232, 66, 1) 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(210, 255, 82, 1)), color-stop(100%, rgba(145, 232, 66, 1)));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(210, 255, 82, 1) 0%, rgba(145, 232, 66, 1) 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(210, 255, 82, 1) 0%, rgba(145, 232, 66, 1) 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(210, 255, 82, 1) 0%, rgba(145, 232, 66, 1) 100%);
/* IE10+ */
background: linear-gradient(to bottom, rgba(210, 255, 82, 1) 0%, rgba(145, 232, 66, 1) 100%);
/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#d2ff52', endColorstr='#91e842', GradientType=0);
/* IE6-9 */
transition: height 0.8s ease;
transition-delay: 1s;
}
.header.enabled {
overflow: hidden;
background:#FFF;
border-bottom:1px solid gray;
box-shadow:0 0 10px;
height:70px;
position:fixed;
top:0px;
width:100%;
z-index:2;
background: rgb(210, 255, 82);
/* Old browsers */
background: -moz-linear-gradient(top, rgba(210, 255, 82, 1) 0%, rgba(145, 232, 66, 1) 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(210, 255, 82, 1)), color-stop(100%, rgba(145, 232, 66, 1)));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(210, 255, 82, 1) 0%, rgba(145, 232, 66, 1) 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(210, 255, 82, 1) 0%, rgba(145, 232, 66, 1) 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(210, 255, 82, 1) 0%, rgba(145, 232, 66, 1) 100%);
/* IE10+ */
background: linear-gradient(to bottom, rgba(210, 255, 82, 1) 0%, rgba(145, 232, 66, 1) 100%);
/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#d2ff52', endColorstr='#91e842', GradientType=0);
/* IE6-9 */
transition: height 0.8s ease;
transition-delay: 1s;
}
.header.enabled:hover {
height: 120px;
transition: height 0.8s ease;
}