Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 29th, 2012, 04:34 PM
Authorized User
 
Join Date: Dec 2011
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Default image fade

how do i fade in an image in the following scenario....

a person submits a form. php validation goes through. everything is ok. image is faded in.
 
Old March 1st, 2012, 07:13 AM
Friend of Wrox
 
Join Date: Nov 2009
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Smile jQuery.fadeIn

Hi there

use jQuery methods

http://www.jquery.com

HTML Code:
<img id="myImg" src="someSrc.jpg" style="visibility:hidden" />
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){ // eqv to page_load
   $("#myImg").fadeOut(0);
});

function validateValues(){
   $.ajax({

      url: "yourpage.php?yourparams=values",
      type: "get",
      success: function(result){

         if(result.toString() == "OK"){ // == "YOUR_PHP_RETURNED_VALUE"
            $("#myImg").css('visibility', 'visible');
            $("#myImg").fadeIn("slow");
         }else{
            // do other thing (maybe alert to user to check values)
         }

      } // success

   }); //$.ajax

} // validateValues


</script>
__________________
happy every time, happy every where

Reza Baiat





Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash - fade in then stay Teessider_2000 Flash (all versions) 2 August 16th, 2007 02:57 PM
fade in not working in FF but does in IE crmpicco Javascript How-To 1 November 8th, 2005 12:49 PM
fade in/fade out on a div with JavaScript crmpicco Javascript How-To 1 September 23rd, 2005 04:27 AM
javascript image fade in fade out crmpicco Javascript How-To 0 September 12th, 2005 11:02 AM
ASP.NET 1.0 fade out ccnoaccnoa BOOK: Beginning ASP.NET 1.0 1 October 17th, 2003 02:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.