English 中文(简体)
j Query Opacity Animate
原标题:jQuery Opacity Animate
  • 时间:2012-01-14 22:51:53
  •  标签:
  • jquery

奥凯,我的目标是把用户点击成四点,并再作一小块的不透明变化,从0到1,但不是真正的。

HTML
    <div id="container">

    <div id="middlebottom"><div id="portfolio">Portfolio</div></div>



    </div>

    <div id="portfoliocontainer"> </div>



JQUERY        
    $( #middlebottom ).click(function() {
      $( #portfoliocontainer ).animate({
        opacity: 1.0;
      });
    });


CSS
    #portfoliocontainer {
    height: 0%;
    width: 100%;
    top: 0;
    position: absolute;
    background-color: #FF2D2D;
    opacity:0;
    filter:alpha(opacity=0); }

    #portfolio {
    margin: 30px; }

    #middlebottom {
    width: 40%;
    height: 30%;
    background-color: #FF2D2D;
    position: absolute;
    left: 40%;
    bottom: 0;
    -webkit-transition-duration: .7s;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 50px;
    font-style: normal;
    font-weight: bold;
    text-transform: normal;
    letter-spacing: -2px;
    line-height: 1.2em;
    color: #FF9898; }

我在“ j”上说了新东西,因此我不能真正确定什么是错误的。 我认为,我这样做是正确的,但却没有工作。

最佳回答

Why don t you just use fadeIn() ?

Edit: Here is the code I tried and works for me:

<html>
<head>
    <link rel="stylesheet" type="text/css" href="" /> 
    <meta charset="utf-8" />
    <title></title>
</head>

<body>
    <div id="middlebottom">
        Your middle bottom div
    </div>

    <div id="portfoliocontainer" style="display: none;">
        Your Portfolio container
    </div>


<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
    $( #middlebottom ).click(function(){ 
        $( #portfoliocontainer ).fadeIn(); 
    }); 
</script>
</body>
</html>
问题回答

你再说一大问题是,你有一yn错。 应将“半殖民地”从你们重新进入亲密功能的选项中删除:

$( #portfoliocontainer ).animate({ 
    opacity: 1.0 // instead of opacity: 1.0; 
});

I m hoping that the HTML you supplied was incomplete because even after fixing the syntax issue you won t actually see anything because you ve styled the portfolio container to have 0% height. Content will need to be added to that container or it must be styled differently in order to see the animation.





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签