?
Solved

URGENT  NEED TO SLIDE IN DIV WITH JQUERY JAVASCRIPT

Posted on 2010-09-12
8
Medium Priority
?
517 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 22

Accepted Solution

by:
kadaba earned 1000 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 500 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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 

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
 
LVL 22

Assisted Solution

by:kadaba
kadaba earned 1000 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 500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

764 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