I want to make a message that fades in the page and then fades out to show the user they logged in on the login before being redirected to the profile, but the message just appears on the screen with no fade, but it does fade off which is good.
This is the code I have for it:
echo "
<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\">
</script>
<script>
$(function() {
$('button').click(function() {
$('p').fadeIn(3000);
$('p').fadeOut(5000);
});
});
</script>";
$error = "<meta http-equiv='refresh' content='100; Me'>
<p style='font-weight:bold;color:green;padding:3px;'>Welcome back $name!</p>";
For fadeIn to work the element has to be hidden first
$(function () {
$('button').click(function () {
$('p').hide().fadeIn(3000).fadeOut(5000);
});
});
You need to start the page with your <p> element hidden.
Just add display:none to the <p> style.