Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery, slide-in text

I am new to jQuery. How can I make some text slide in? I tried this and 1) it does not work, and 2) I might prefer to have it slide in from the side

$("#someId").html("hello").slideDown('slow');
like image 704
Roger Avatar asked Nov 20 '25 08:11

Roger


1 Answers

It's hard to tell what's wrong without more information, since there are several possible points where things can go wrong. Here are some possibilities:

  1. If the element is already showing, it won't animate.
  2. If the jquery selection ends up not picking up any elements, you won't see anything either. Is there an element with the id 'someId' in your DOM tree?

Here's an example of a use of slideDown:

<!DOCTYPE html>
<html lang="en">
   <head>
     <script src="jquery.js" type="text/javascript"></script>
     <script type="text/javascript">
         $(document).ready(
             function() {
                 $("#someId").hide();
                 $("#someId").html("hello").slideDown('slow');
         });
     </script>
  </head>
  <body>
      <div id="someId"></div>
  </body>
</html>
like image 125
dyoo Avatar answered Nov 22 '25 03:11

dyoo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!