- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的中间右侧有一个箭头,当鼠标悬停在它上面时,会显示一个侧边栏,当单击该侧边栏的每个图标时,侧边栏会扩展显示内容。一旦用户将鼠标移出侧边栏,侧边栏内容就会折叠起来。我的网站是here (将鼠标悬停在右侧的箭头上,然后单击其中一个图标,然后将鼠标移出以查看我的问题)。问题是,当鼠标仍在侧边栏上时侧边栏会折叠。
就好像被认为是“鼠标悬停”的侧边栏区域与显示的侧边栏区域不同。
我指的代码如下
HTML
<div id="sidebar">
<div id="newsbar" class="icon"><img src="images/icons/whatsnew.png" width="70" height="70" alt="Ninja Warrior News"></div>
<div class="sidebarinfocontent" id="newscontent"><h1>Latest</h1>
<p>The past few months, I have been working on a brand new website design and am delighted to finally be able to present it to you. This new design features a brand new comprehensive sidebar which greatly enhances both the look and the breakdown of content on the website. In addition, there is a slightly modified navigation bar with new red and blue colored buttons. You will also find that the background of the site has changed from a red and brown gradient to a solid black which does not clash nearly as much with the banner and with content. Let us know what you think in the feedback section.</p>
<p> </p>
<h2 align="center" style="padding-bottom:5px;">How Many Pageviews?</h2>
<iframe src="http://www.seethestats.com/stats/11594/Pageviews_9ec4cf0b2_ifr.html" style="width:270px;height:142px;border:none;" scrolling="no" frameborder="0"></iframe></div>
JQuery
//sidebar appearance
$("#sidebar").mouseout(function(e) {
$("#sidebar").css("right","-120px");
$("#arrow").fadeIn(1200);
});
$("#arrow").mouseover(function(e) {
$("#sidebar").css("right","0px");
$("#arrow").fadeOut(400);
});
$("#sidebar").mouseover(function(e) {
$("#sidebar").css("right","0px");
$("#arrow").fadeOut(400);
});
$(".icon").click(function(e) {
$(".sidebarinfo").css("right","0px");
$("#sidebar").css("right","-120px");
});
$(".sidebarinfo").mouseout(function(e) {
$(".sidebarinfo").css("right","-290px");
$(".sidebarinfocontent").css("display","none");
});
//Sidebar individual icon clicks
$("#newsbar").click(function(e) {
$("#newscontent").css("display","block");
});
最佳答案
阅读您的所有评论后,我已经在本地测试了您的网站并解决了问题。在这里解释一切真的很困难。这完全是关于逻辑思维的。所以我要给出确切的答案。
您需要使用以下脚本更新您的 main.js 文件。您在问题中只给出了一个部分。但在这里我要给出两个部分。您需要更新代码中的这两个部分。
// Sidebar appearance
$("#sidebar").mouseout(function(e) {
$("#sidebar").css("right","-120px");
$("#arrow").fadeIn(1200);
});
$("#arrow").mouseover(function(e) {
$("#sidebar").css("right","0px");
$("#arrow").fadeOut(400);
});
$("#sidebar").mouseover(function(e) {
$("#sidebar").css("right","0px");
});
$(".icon").click(function(e) {
$(".sidebarinfo").css("right","0px");
$("#sidebar").css("right","-120px");
});
$(".sidebarinfo").mouseout(function(e) {
$(".sidebarinfo").css("right","-290px");
$("#sidebar").css("right","-120px");
});
$(".sidebarinfocontent").mouseover(function(){
$('.sidebarinfo').css("display","block");
$(".sidebarinfo").css("right","0px");
});
//Sidebar individual icon clicks
$("#newsbar").click(function(e) {
$(".sidebarinfocontent").css("display","none");
$("#newscontent").css("display","block");
});
$("#obstaclesbar").click(function(e) {
$(".sidebarinfocontent").css("display","none");
$("#getobstaclescontent").css("display","block");
});
$("#aboutmebar").click(function(e) {
$(".sidebarinfocontent").css("display","none");
$("#aboutmecontent").css("display","block");
});
$("#searchbar").click(function(e) {
$(".sidebarinfocontent").css("display","none");
$("#searchcontent").css("display","block");
});
$("#quizbar").click(function(e) {
$(".sidebarinfocontent").css("display","none");
$("#quizcontent").css("display","block");
});
$("#contactbar").click(function(e) {
$(".sidebarinfocontent").css("display","none");
$("#contactcontent").css("display","block");
});
关于javascript - 鼠标悬停在不覆盖整个 Div 的区域上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24254735/
我正在学习和使用 jQuery,并且想要显示某些元素的删除图标。 我有一个外部主 div,其中包含许多元素的包装器。在元素包装器内部,我想当用户将鼠标悬停在元素包装器上时显示删除图标,并在用户移出元素
已关闭。此问题需要 debugging details 。目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and the
我从 Qt 开始,每当有人将鼠标悬停在 QPushButton 上时,我想将 QPushButton 设置为不同的图标。到目前为止,这是我的代码: #include QPushButton *but
我从 Qt 开始,我想在有人将鼠标悬停在 QPushButton 上时将其设置为不同的图标。到目前为止,这是我的代码: #include QPushButton *button = new QPus
我有以下代码... jQuery(function($) { var timer; $('.action-viewer').hide(); $('.task').on('mouseover
我有一张照片,当用户将鼠标悬停在它上面时,我会在照片顶部显示(使用绝对定位)2 个箭头,一个用于进入上一张照片,一个用于进入下一张照片。这是到目前为止的代码... $('a.large_product
$('li > a').hover( function(){ $(this).animate({ backgroundColor: '#2a639a', color: '#fff'
我有一个悬停事件附加到几个链接,当您点击它时,会出现一个框。 有没有一种方法可以让悬停事件仅在鼠标悬停在链接上超过 500 毫秒时触发?因此,目前只要鼠标移到链接上,就会出现该框,但我希望只有当鼠标悬
我正在创建包含各种样式控件的演示应用程序。它允许我快速预览更改。 我的问题是下面的代码不起作用: Pressed button 它表示 IsPressed 的 setter 受到保护。我明白了,但我需
我正在尝试使用 js 并创建带有一些“信息文本”的“描述框” HTML google JS function info() {} 我不知道是哪个代码用一些文本创建了所谓的“描
我有一个 Accordion 风格的菜单,在悬停状态下工作正常,但我想改为点击... $(document).ready(function(){ $('#nav > li').hover(
我正在使用 Chartjs v.1.0.2 并尝试将点设置为仅在悬停在当前点上时出现。同样的问题是当我使用悬停或鼠标悬停时。可以使用 getPointsAtEvent(e); 找到当前点,但它仅在我将
我使用foreach 语句访问IEnumerable 的所有元素并将其呈现在详细信息页面中。我想让每个元素的悬停属性只影响一个元素。所以我使用 jQuery 单独影响每个元素 但是当我运行代码并将鼠标
首先提前感谢您的帮助。 案例:我在一行中有多个 div。这些 div 位于一个框中,我可以在此框中水平滚动以查看其他 div。我制作了两个按钮(L 表示左侧,R 表示右侧),以便在悬停或单击这些按钮时
我正在创建一个应用外观页面。 我希望在鼠标悬停时打开底部菜单上的其中一个按钮。 这感觉像是一项简单的任务,但我所做的一切似乎都不起作用。我错过了什么,我做了很多研究,但似乎找不到解决方案。 我尝试使用
我遇到的问题是,当您将鼠标悬停在按钮上时,只有按钮的某些部分会触发悬停/可点击状态,而不是所有实际 block 。有什么想法吗? 这是使用它的站点:http://www.revival.tv/turn
我有一位客户想要在他们的网站上实现特定功能,但我有点困惑如何做到这一点。 基本上,如果你查看他们的 existing site您可以看到 4 个圆形按钮。 他们想要的是,当有人将鼠标悬停(或单击,如果
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 关闭 9 年前。 关于您编写的代码问题的问题必须在问题本身中描述具体问题 — 并且包括有效代码 以
我目前正在编写我的第一个响应式网站(总的来说我是一个初学者)并且我遇到了很多障碍。其中之一是我的菜单有问题。我会尽量具体。我有一个用于桌面的水平菜单和一个用于平板电脑/手机的垂直菜单。我不知道如何解决
我正在为网站创建菜单。我正试图在链接上实现悬停 和点击 效果。我希望列表元素 a 上的悬停事件触发彩色动画并添加“事件”类。如果触发了点击和悬停事件,我想为该元素分配相同的类。问题是,一旦元素未悬停并
我是一名优秀的程序员,十分优秀!