473,978 Members | 2,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with a javascript transition

7 New Member
So I was on here the other day looking for help with the getElementByNam e method and recieved excellent help quickly. (Thankyou GITS) Now, I'm looking for some help with making some dynamic content transition (every 4 seconds).
Essentially what I have is 5 hidden divs in a php page. In my javascript code they get stored into an array and the setTimeout method is used to call then them one after the other. Instead of just having them switch I would like them to have an animated transition (a vertical push to be exact). The js code is listed below and the website to view this code is www.thenicheplayers.com
Expand|Select|Wrap|Line Numbers
  1. // Rotating headlines
  2.  
  3. var headlines = [];
  4. var idx = -1;
  5.  
  6. function get_headline_containers() {
  7.     var all_divs = document.getElementsByTagName('div');
  8.     var hdl_divs = [];
  9.  
  10.     for (var i = 0; i < all_divs.length; i++) {
  11.         var div = all_divs[i];
  12.  
  13.         if (div.className == 'headline') {
  14.             hdl_divs.push(div);
  15.         }
  16.     }
  17.  
  18.     return hdl_divs;
  19. }
  20.  
  21. function display_headline(idx) {
  22.     for (var i = 0; i < headlines.length; i++) {
  23.         headlines[i].style.display = i == idx ? 'block' : 'none';
  24.     }
  25. }
  26.  
  27. function rotate_headlines() {
  28.     idx++;
  29.  
  30.     if (idx >= headlines.length) {
  31.         idx = 0;
  32.     }
  33.  
  34.     display_headline(idx);
  35.  
  36.     window.setTimeout(function() {
  37.         rotate_headlines();
  38.     }, 4000);
  39. }
  40.  
  41. function init_page() {
  42.     headlines = get_headline_containers();
  43.     rotate_headlines();
  44. }
Sep 21 '07 #1
4 2112
pbmods
5,821 Recognized Expert Expert
Heya, Scooby.

Please use CODE tags when posting source code:

[CODE=javascrip t]
JavaScript code goes here.
[/CODE]
Sep 21 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
What do you mean by a vertical push? Could you give an example?
Sep 23 '07 #3
scoobydoo9749
7 New Member
http://elouai.com/javascript/javascript-transitions-6.php

If you scroll halfway down the page theirs buttons in two columns. Left hand side, the second one says "transition Slide push". It works if youre using IE but not Firefox. Thats the kind of animation Im looking for but the stipulations are:
1) It would be pushed down, instead of pushed to the left
2) It would have better browser compatibility (ie IE, Firefox, and Safari)
3) It would go every 4 seconds, as called out by the setTimeout method in the code above.
Sep 24 '07 #4
gits
5,390 Recognized Expert Moderator Expert
hi ...

may be you want to have a look at the mootools ... goto the demo page and have a look at the slide transitions ... perhaps you will find what you are looking for ...

kind regards
Sep 24 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

21
2227
by: Steven Bethard | last post by:
Jack Diederich wrote: > > itertools to iter transition, huh? I slipped that one in, I mentioned > it to Raymond at PyCon and he didn't flinch. It would be nice not to > have to sprinkle 'import itertools as it' in code. iter could also > become a type wrapper instead of a function, so an iter instance could > be a wrapper that figures out whether to call .next or __getitem__ > depending on it's argument. > for item in...
1
3456
by: Terry | last post by:
Hi, I am looking for a javascript that can do a banner rotation of multiple images with nice transition between them. The pictures will be displayed automatically upon loading the pages. Thanks in advacne, Terry
3
1810
by: #pragma once | last post by:
That's all we are expecting from programs written in the managed code; Though a MVP advised not to say that, because after JIT compilation the code runs in the native! Funny, isn't? That means scripting languages run in the Host code and never in the native? That means scripting languages are poorer than .NET in speed just because they are hosted by an interpreter? What about .Net run time libraries? Can any one tell me the differences?...
6
13033
by: Tony G. | last post by:
Hi there, I have an APS 3 application, running on a Windows 2003 Web edition server - it is a very busy website, and when users are click on certain links (membership info), a new window i opened via javascript. This new window is on the SAME website as where the user is located, but just opened in HTTPS (secure) mode - the user can now examine memberhip terms and continue to buy membership.
62
3874
by: TheShadow1 | last post by:
safetyTips - this array is in here.js ...
8
3067
by: Workgroups | last post by:
I've got a page where the nature of the beast is such that the user clicks a submit button to ransomize some data in somewhat rapid succession (once per second, give or take). The page generates a little table, 10x10, of small pictures that represent the randomized data. The submit button tells the server (which is keeping track of which pictures are where) to scramble them around and output a new table. The output is simple HTML. The...
16
2251
by: zwetan | last post by:
Hi, often I see people telling that "javascript sucks" - is it because of the DOM with JS ? - is it because of the language in itself ? - is it because browsers/hosts differences ? - is it because of language limitation ? etc. please don't turn this into a flame/troll war,
14
5984
by: Gale | last post by:
I wrote a simple script for image rotation. now i need to have some transition effect betwean images in JS What do you suggest ? Thank you
0
2491
by: hynek.cihlar | last post by:
A strange behaviour thatI found in ASP.NET 2.0. I am trying to issue a callback request (handled by ICallbackEventHandler and RaiseCallbackEvent) and a regular GET request in the client browser and handle them at the same time - in parallel. The funny thing is that the behaviour of the implementation I created depends on the existence of Global.asax in the Web application. Here is the source of the page that handles the regular GET...
0
11413
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10917
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8464
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7618
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6561
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5161
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4733
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3765
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.