我正在使用jqueryNoty插件。
当触发onPageLoad
事件时,插件会显示出来,并告诉您将头悬停在<div>
上。
无论如何,Noty
就在它下面。如果您将头悬停在<div>
上,它将展开,并将Noty
留在顶部。看起来一团糟。
有了z-index
我可以把它放下,但这不是我想要的。
我需要禁用header:hover
才能禁用,直到您确认Noty
。
不可能让它在JSFiddle上工作,但这里是靠近main的代码:
CSS:
.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:hover {
height: 120px;
transition: height 0.8s ease;
}
.noty {
top: 70px;
position: relative;
}
HTML格式
<div class="header">
<img src="artotek_ico.gif" height="70px" style="padding-bottom: 10px;" />
<span class="kielet">
<nav>
<!--Englanti-->
<a href="en_index.html" title="Englanniksi">In English</a>
<!--Ruotsi-->
<a href="swe_index.html" title="Ruotsiksi">På Svenska</a>
<!--Venäjä-->
<a href="ru_index.html" title="Venäjäksi">По русски</a>
</span>
</div>
<div class="noty">
<!--jQuery Plugins Declarations-->
</div>
JavaScript
var n = noty()
};
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() {},
afterShow: function() {},
onClose: function() {},
afterClose: function() {}
},
buttons: false // an array of buttons
};
最佳答案
将标题的悬停类更改为:
.header.enabled:hover {
height: 120px;
transition: height 0.8s ease;
}
这将限制CSS:hover样式在
.header
也有类enabled
时使用。然后在适当的noty回调中添加或删除
enabled
上的类,例如。onShow: function() { $(".header").removeClass("enabled"); },
onClose: function() { $(".header").addClass("enabled"); },