Results 1 to 5 of 5

Thread: apDiv animation

  1. #1
    Join Date
    Jan 2012
    Location
    India
    Posts
    45
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default apDiv animation

    i want to animated apDiv in my page, anybody knows how to do that? please help
    it is on bottom right on my page and i want it to appear like it is coming from bottom

    here my code

    HTML Code:
    <html>
    <head>
    <style type="text/css">
    #apDiv1 {
    	position:fixed;
    	right:0px;
    	bottom:0px;
    	width:242px;
    	height:196px;
    	z-index:1;
    	background:#09F;
    	color:#FFF;
    	border:#000 2px solid;
    }
    </style>
    </head>
    <body>
    <div id="apDiv1">this is an apDiv :)</div>
    </body>
    </html>

  2. #2
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    Code:
    <html>
    <head>
    <style type="text/css">
    #apDiv1 {
    	position:fixed;
    	right:0px;
    	bottom:-300px;
    	width:242px;
    	height:196px;
    	z-index:1;
    	background:#09F;
    	color:#FFF;
    	border:#000 2px solid;
    }
    </style>
    </head>
    <body>
    <div style="height:2000px;" ></div>
    <div id="apDiv1">this is an apDiv :)</div>
    <script type="text/javascript">
    /*<![CDATA[*/
    
    function SlideUp(id,ms){
     obj=document.getElementById(id);
     animate('bottom',obj,-obj.offsetHeight,0,new Date(),ms);
    }
    
     function animate(mde,obj,f,t,srt,mS){
      var ms=new Date().getTime()-srt,now=(t-f)/mS*ms+f;
      if (isFinite(now)){
       obj.style[mde]=now+'px';
      }
      if (ms<mS){
       setTimeout(function(){ animate(mde,obj,f,t,srt,mS); },10);
      }
      else {
       obj.style[mde]=t+'px';
      }
     }
    
    SlideUp('apDiv1',1000);
    /*]]>*/
    </script></body>
    </html>
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  3. The Following User Says Thank You to vwphillips For This Useful Post:

    ankush (02-13-2012)

  4. #3
    Join Date
    Jan 2012
    Location
    India
    Posts
    45
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default

    thank you so much, exactly what i was looking for, and one question where can i define its delay? so that it will come after 2 second of page load.

  5. #4
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    Code:
    <html>
    <head>
    <style type="text/css">
    #apDiv1 {
    	position:fixed;
    	right:0px;
    	bottom:-300px;
    	width:242px;
    	height:196px;
    	z-index:1;
    	background:#09F;
    	color:#FFF;
    	border:#000 2px solid;
    }
    </style>
    </head>
    <body>
    <div style="height:2000px;" ></div>
    <div id="apDiv1">this is an apDiv :)</div>
    <script type="text/javascript">
    /*<![CDATA[*/
    
    function SlideUp(id,ms){
     obj=document.getElementById(id);
     animate('bottom',obj,-obj.offsetHeight,0,new Date(),ms);
    }
    
     function animate(mde,obj,f,t,srt,mS){
      var ms=new Date().getTime()-srt,now=(t-f)/mS*ms+f;
      if (isFinite(now)){
       obj.style[mde]=now+'px';
      }
      if (ms<mS){
       setTimeout(function(){ animate(mde,obj,f,t,srt,mS); },10);
      }
      else {
       obj.style[mde]=t+'px';
      }
     }
    
    setTimeout(function(){
     SlideUp('apDiv1',1000);
    },2000);
    
    /*]]>*/
    </script></body>
    </html>
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  6. The Following User Says Thank You to vwphillips For This Useful Post:

    ankush (02-13-2012)

  7. #5
    Join Date
    Jan 2012
    Location
    India
    Posts
    45
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default

    thanks a lot

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •