roanjain
roanjain

Reputation: 1252

apply fadein() effect of jquery to php echo

i would like to apply jquery fadein() effect to what php echo displays..

   <?php 
    echo "Name";
   ?>

what is does simply display the "Name" within echo...but i want that "Name" to come up with an fadein() effect of jquery....

my code is like..

echo"<div id='title'>
             <span style='margin-top:1%; margin-left:3%;float:left;color: #3bb598'>campus name </span>
             <span style='margin-top:1%; margin-right:3%;float:right;color: #3bb598'>city</span>
             <br>
             <table><tr>
             <th><img src='rj.jpg' id='img' align='top'></th>
             <th>".$textid."</th>   
             </tr></table> 
             </div>
            ";

i want the result inside echo should come with a fadein() effect.

Upvotes: 0

Views: 469

Answers (2)

in css, hide the id title with display:none;

This will hide the div without loading javascript, its better to use css here.

in jquery, use:

$(function(){ $('#title').fadeIn(); });

for fade speed, modify above code to $('#title').fadeIn('time'); where time can be "slow","fast" or any number.

Upvotes: 1

vignesh.D
vignesh.D

Reputation: 776

This is what I did. wrapped a div around my PHP code with id fadein and then used this jquery code:

$(function(){
    $('#fadein').hide();
    $('#fadein').fadeIn();
});

Easy

Upvotes: 1

Related Questions