所以我有一个巨大的 svg 文件,其中包含一个小矩形。我希望当您将鼠标悬停在该矩形上时它会改变颜色。我不能使用 onmouseover b/c,即 java,这是一个学校项目,我们被告知只能使用 html、html5、css 和 css3。我一直在尝试各种事情,但我不明白为什么它不起作用。我只添加了矩形 g 容器位。以及我正在使用的样式代码。我尝试将此样式代码添加到标头中,就在 svg 起始标记之后,添加到 g 容器中,添加到 rect 本身中(在本例中没有样式标记)。我可以添加整个 svg 文件,但那东西很大,所以我只会根据要求执行此操作。
<g
inkscape:groupmode="layer"
id="layer12"
inkscape:label="Hobitton Stadticon"
style="display:inline"
sodipodi:insensitive="true"
>
<style type="text/css">
<![CDATA[
.rect10023:hover {fill: #0000FF;}]]>
</style>
<rect
style="fill:#DF0101;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;"
id="rect10023"
width="8.2568808"
height="6.880734"
x="266.97247"
y="201.43393"
/>
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
x="343.72607"
y="-32.097607"
id="text10025"
sodipodi:linespacing="125%"
transform="matrix(0.72346735,0.6903586,-0.6903586,0.72346735,0,0)"
inkscape:transform-center-x="10.550459"
inkscape:transform-center-y="-7.7981651"><tspan
sodipodi:role="line"
id="tspan10027"
x="343.72607"
y="-32.097607"
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Chiller;-inkscape-font-specification:Chiller">Hobbiton</tspan></text>
</g>
Run Code Online (Sandbox Code Playgroud) 您好,我正在尝试创建悬停效果,因此当有人将鼠标悬停在带有 LI 元素的图像上时,该图像将保持完全不透明,但其他 LI 元素会稍微淡出。我知道这是可以做到的,但目前我的代码正在使所有内容淡出。
请在我的代码下面找到一个小提琴。
非常感谢任何帮助。
.imageWrapper {
position: relative;
z-index: 5;
}
.imageWrapper:after {
content: " ";
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
display: block;
z-index: 10;
transition: background 0.3s linear;
}
.cpClientIcon {
/*
.cpImageWithTitle {
.title {
@include opacity(0);
transition:opacity 0.3s linear;
}
}
*/
}
.cpClientIcon:hover .imageWrapper:after, .cpClientIcon:focus .imageWrapper:after, .cpClientIcon:active .imageWrapper:after {
background: red;
}
.cpClientIcon:hover .imageWrapper:hover, .cpClientIcon:hover .imageWrapper:focus, .cpClientIcon:hover .imageWrapper:active, .cpClientIcon:focus .imageWrapper:hover, .cpClientIcon:focus .imageWrapper:focus, .cpClientIcon:focus .imageWrapper:active, .cpClientIcon:active .imageWrapper:hover, .cpClientIcon:active .imageWrapper:focus, …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我需要处理鼠标悬停事件来更改按钮的背景。使用 MFC 类向导,我无法在该项目的事件列表中找到鼠标悬停条目。我尝试使用PreTranslateMessage,但它不起作用。我该如何处理该事件?
根据标准,我尝试为我的事件处理程序尽可能多地使用 jQuery 的 on() 方法。我尝试使用 on('hover') 而不是悬停(),但它不起作用。我该怎么做才能使这段代码与 on() 而不是悬停() 一起使用?是否有我可以看到的与 on() 方法一起使用的事件列表?
$(document).ready(function(){
$('#navigation li').on('hover', function(){
$(this).animate({
paddingLeft: '+=15px'
}, 200);
}, function(){
$(this).animate({
paddingLeft: '-=15px'
}, 200);
});
});
Run Code Online (Sandbox Code Playgroud) 我已经实现了一个悬停状态,当 div 悬停时,该状态会覆盖文本。
这是代码 -
.desktop-image {
position: relative;
}
.img_description {
position: absolute;
top: -13%;
bottom: 0;
left: 0;
right: 0;
color: #000;
visibility: hidden;
opacity: 0;
transition: opacity .7s, visibility .7s;
}
.desktop-image:hover .img_description {
visibility: visible;
opacity: 1;
}Run Code Online (Sandbox Code Playgroud)
<div id="images" class="misma">
<div class="desktop-image">
<img src="http://via.placeholder.com/200x200">
<p class="img_description">This image looks super neat.</p>
</div>
<div class="mobile-image-misma">
<img src="http://via.placeholder.com/100x100">
</div>
</div>Run Code Online (Sandbox Code Playgroud)
问题
当我检查页面时,我注意到 div.desktop-image占据了屏幕的整个宽度(见图)。
问题 我怎样才能使这个 div 换行到实际图像的大小,以便仅当该图像悬停时才实现悬停状态,而不是悬停在蓝色部分内的任何位置时。
谢谢
我想让我的视频在鼠标悬停和鼠标移出时播放。我的页面上大约有 4 个视频。我的 HTML 看起来像这样:
<div class="project-container">
<video class="content" controls loop>
<source src="videos/THESIS_VIDEO.mov">
</video>
</div>
Run Code Online (Sandbox Code Playgroud)
谢谢!
我正在开发一个闪亮的应用程序,其中我只想在悬停或鼠标悬停操作时进行文本输出
我尝试添加一个操作按钮
用户界面:
fluidRow(box (title = p("Rates by Gender and Race", actionButton("titleBtId", "", icon=icon('question-circle'),class = "btn-xs", title = "Info"),textOutput("text_id"),hover=T), width = 15, status = 'primary', solidHeader = TRUE,tabPanel('',plotlyOutput("racegender",height = "100%"))%>% withSpinner(color="#0dc5c1")))
Run Code Online (Sandbox Code Playgroud)
服务器:
output$text_id <- renderText({
paste0("hi")
})
Run Code Online (Sandbox Code Playgroud)
我不确定如何编辑它以仅在悬停时显示文本
这是我的default.vue 文件
<template>
<div class="ch-container">
<header class="ch-header">
<nav
class="navbar is-fixed-top"
role="navigation"
aria-label="main navigation"
>
<div class="navbar-brand">
<nuxt-link class="navbar-item" to="/">
<img
alt="CH Logo"
src="https://i.imgur.com/v35Kfc9.png"
width="28"
height="28"
/>
</nuxt-link>
<a
role="button"
class="navbar-burger burger"
aria-label="menu"
aria-expanded="false"
data-target="navbarBasicExample"
>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start">
<nuxt-link class="navbar-item" to="/news">
News
</nuxt-link>
<nuxt-link class="navbar-item" to="/resources">
Resources
</nuxt-link>
<nuxt-link class="navbar-item" to="/tickers">
Tickers
</nuxt-link>
<div class="navbar-item has-dropdown …Run Code Online (Sandbox Code Playgroud) 我需要 x-on:mouseenter="itemActive = {{ index }}"和x-on:mouseleave="itemActive = false"状态x-on:click="itemActive = {{ index }}"在x-on:click.away="itemActive = false"屏幕上小于 768px。下面的代码与较大屏幕的悬停部分完美配合,但似乎无法弄清楚如何使其适用于不同的屏幕尺寸。
我正在使用 Twig、Tailwind 和 Alpine.JS。
<div x-data="{itemActive: false}" class="w-full pb-12 mt-5 overflow-x-hidden overflow-y-scroll md:flex md:flex-wrap md:w-auto md:mt-0 md:pb-0 md:overflow-visible">
{% for item in menu.items %} {% set index = loop.index0 %}
<div x-on:mouseenter="itemActive = {{ index }}" x-on:mouseleave="itemActive = false" class="flex flex-wrap w-full md:block md:w-auto {{ item.classes|join(' ') }}">
<a :class="{'bg-gray-900' : itemActive === {{ index }}}" class="flex flex-wrap …Run Code Online (Sandbox Code Playgroud) 我在plotly(R) 中创建了一个带有辅助y 轴的图。我使用hoverfunction x Unified,但我想更改标题中的日期格式。数据是每周数据,所以现在你在胡佛中看到:2022年1月1日,但我想看到的是:1月1日(第01周)或1月1日 - 22年1月8日。我用tickprefix尝试了一些东西,但后来也刻度在变化,而不仅仅是悬停。
我现在的演示代码是:
library(plotly)
# dummy data
df_data1 = data.frame(date_input = seq(as.Date('2022/01/01'), as.Date('2022/07/01'), by="week")
, value=1:26)
df_data2 = data.frame(date_input = seq(as.Date('2022/01/01'), as.Date('2022/07/01'), by="week")
, value2=3:28)
plot1 <- plot_ly()
plot1 <- plot1 %>%
add_trace(data = df_data1, x = ~date_input, y = ~value
, type = 'scatter', mode = "lines", yaxis = "y", line = list(color = '#E64B35FF', opacity = 0.8)
, showlegend = FALSE
, hovertemplate = ~paste('# Value1: %{y:.0f}<extra></extra>')) %>%
add_trace(data = df_data2, x = …Run Code Online (Sandbox Code Playgroud)