Solved

URGENT  NEED TO SLIDE IN DIV WITH JQUERY JAVASCRIPT

Posted on 2010-09-12
8
509 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 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to implement server side field validation and display customized error messages to the client.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
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).

691 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