为什么我不能使用Jquery设置Visiblitity属性? [英] Why I Cant Set Visiblitity Property Using Jquery?
本文介绍了为什么我不能使用Jquery设置Visiblitity属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
.html代码
.html code
<html>
<head>
<title>The jQuery Example</title>
<link rel="stylesheet" type="text/css" href="css/main.css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("#out").hover(function(){
$("#block").animate({
visibility: "visible",
width: "300px",
opacity: 0.4,
marginLeft: "0.6in",
fontSize: "3em",
borderWidth: "10px"
}, 1500 );
});
$("#in").hover(function(){
$("#block").show("scale",1500);
$("#block").animate({
visibility: "visible",
width: "900px",
opacity: 1.0,
marginLeft: "0in",
fontSize: "100%",
borderWidth: "1px"
}, 1500 );
});
});
</script>
<style>
div {background-color:#bca; width:100px; border:1px solid green;}
</style>
</head>
<body>
<p>Click on any of the buttons</p>
<button id="out"> Animate Out </button>
<button id="in"> Animate In</button>
<!--<img id="in" src="img/bat.jpg"/>
<img id="out" src="img/bat.jpg"/>-->
<div id="block"><img src="img/bat.jpg"/></div>
</body>
</html>
.css代码
.css code
#block
{
visibility:hidden;
}
最初我使用css设置div标签的属性hidden和图像悬停效果我想看到div标签,但代码不起作用.. !!
Initially i set the property of div tag "hidden" using css and on image hover effect i want to visible that div tag but the code didn't work ..!!
推荐答案
( document )。ready( function (){
(document).ready(function() {
( #out)。hover( function (){
("#out").hover(function(){
( #block)。animate({
visibility:< span class =c ode-string> 可见,
宽度: 300px,
opacity: 0 。 4 ,
marginLeft: 0.6in,
fontSize: 3em,
borderWidth: 10px
}, 1500 );
});
("#block").animate({ visibility: "visible", width: "300px", opacity: 0.4, marginLeft: "0.6in", fontSize: "3em", borderWidth: "10px" }, 1500 ); });
这篇关于为什么我不能使用Jquery设置Visiblitity属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文