试图在悬停时显示iframe

mat*_*w s 1 html javascript iframe

是否有一种方法可以在悬停时显示iframe.

这就是我所拥有的:

<div id="sub1" onmouseover="<iframe src="$('#countdown').load('https://days.to/22-january/2017 #countdown');>some text</div>
Run Code Online (Sandbox Code Playgroud)

zer*_*0ne 5

没有JS/jQ只需要一些CSS转换和一个:hover伪类

SNIPPET

#ifrm1 {
  opacity: 0;
  transition: opacity 1.5s linear;
}
#trig1:hover + iframe {
  opacity: 1;
  transition: opacity 1.5s linear;
}
Run Code Online (Sandbox Code Playgroud)
<a href='#/' id='trig1'>HOVER</a>
<iframe id='ifrm1' name='ifrm1' src='https://days.to/until/christmas'></iframe>
Run Code Online (Sandbox Code Playgroud)