Solved

URGENT  NEED TO SLIDE IN DIV WITH JQUERY JAVASCRIPT

Posted on 2010-09-12
8
503 Views
Last Modified: 2012-05-10
I need to slide in a block of text when a static html page is loaded.

It is an attention getter.

All I need is when the page loads I have a div

<DIV>THIS IS THE TEXT I WANT TO SLIDE IN FROM THE RIGHT </DIV>
0
Comment
Question by:ToString1
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 22

Accepted Solution

by:
kadaba earned 250 total points
ID: 33656940
you mean this way..

<!DOCTYPE html>
<html>
<head>
  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
  <style type="text/css">
  div { margin: 0px; width: 100px; height: 80px; background: green; border: 1px solid black; position: relative; }
</style>

  <script>
  $(document).ready(function() {
    
	$("#slideRite").show("slide", { direction: "right" }, 1000);
	$("#slideLeft").show("slide", { direction: "left" }, 1000);
	
  });
  </script>
</head>
<body style="font-size:62.5%;">
<div id="slideRite" style="display:none;">THIS IS THE TEXT I WANT TO SLIDE IN FROM THE RIGHT </DIV>
<br>
<div id="slideLeft" style="display:none;">THIS IS THE TEXT I WANT TO SLIDE IN FROM THE LEFT </DIV>
</body>
</html>

Open in new window

0
 
LVL 1

Assisted Solution

by:abhimail2002
abhimail2002 earned 125 total points
ID: 33656945
This is what you are looking for:

http://api.jquery.com/slideToggle/

It has some good examples on how to use it.
0
 

Author Comment

by:ToString1
ID: 33656954
Thanks guys

Yes I think this is what I need

abhimail2002 I need this only to be called once onload without clicking
0
 

Author Comment

by:ToString1
ID: 33656959
Yes guys

So I want when the webpage loades I just want a block of text to slide in from the right
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 22

Assisted Solution

by:kadaba
kadaba earned 250 total points
ID: 33656961
You have it in the code I posted sometime back i.e div with id slideRite and the function to go along with it. Thats it.
0
 
LVL 3

Assisted Solution

by:shariati
shariati earned 125 total points
ID: 33656962
Hi check my HTML code in the attachment.
to see the scroll bar add some data in the HTML body . then you can see the beautiful jQuery Scroll for your Div .
I have named the div :"message_box"



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
   <style media="all" type="text/css">
      html, body {
		 font-family:Arial, Helvetica, sans-serif; 
      }
      
      #message_box { 
       position: absolute; 
       top: 0; left: 100%;
	   margin-left:-120px;
       z-index: 10; 
	   background:#ffc;
	   padding:5px;
       border:1px solid #CCCCCC;
       text-align:center; 
       font-weight:bold; 
       width:100px;
      }
      
   </style>
   <script type="text/javascript" 
        src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
 //Loading jQuery From Google
  google.load("jquery", "1.4.2");
 
  google.setOnLoadCallback(function() {
	//scroll the message box to the top offset of browser's scrool bar
	$(window).scroll(function()
	{
  		$('#message_box').animate({top:$(window).scrollTop()+"px" },{queue: false, duration: 350});  
	});  });
</script>

 </script>
<title>Example of Floating Message box using jQuery</title></head>
<body>
 <div id="message_box">The floating message goes here</div>
   
</body>


</html>

Open in new window

0
 

Author Comment

by:ToString1
ID: 33656995
hi thanks shariati:  but I copied but get no animation

0
 
LVL 3

Expert Comment

by:shariati
ID: 33657003
I know .. add text to the body .. for example add this

<pre>
test
test
test
.
.
.
test
</pre>

Open in new window

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now