/[drupal]/contributions/modules/rotor/rotor.js
ViewVC logotype

Contents of /contributions/modules/rotor/rotor.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Tue Apr 1 18:14:43 2008 UTC (19 months, 3 weeks ago) by nestormata
Branch: MAIN
CVS Tags: DRUPAL-5--1-1, DRUPAL-5--1-0, DRUPAL-6--1-0, HEAD
Branch point for: DRUPAL-5--7, DRUPAL-6--1
File MIME type: text/javascript
Initial commit for the rotor module, fully functionally for production
1 // $Id$
2 var rotor_items = new Array();
3 var actual_item = 0;
4 var rotor_interval = null;
5 $(window).load(
6 function() {
7 // Checks that the rotor enabled variable has being set to true
8 // this must be done also by setting the rotor_time variable and the
9 // rotor div. This is done by the drupal module.
10 if(typeof rotor_enabled != 'undefined' && rotor_enabled) {
11 //debugger;
12 $('.rotor_content > .rotor_tab').click(function() {
13 //clearInterval(rotor_interval);
14 //rotor_interval = null;
15 animate_rotor_item($(this).parent());
16 });
17 animate_rotor_item();
18 wait_next_rotor();
19 }
20 }
21 );
22
23 function animate_rotor_item(rotor_item) {
24 if(typeof rotor_item == "undefined" || typeof rotor_item == "number"){
25 rotor_item = $('.rotor_content').get(actual_item);
26 }
27 $('#rotor > .rotor_content > .rotor_content').hide();
28 $('#rotor > .rotor_content > .rotor_tab').removeClass('selected');
29 $('.rotor_content', rotor_item).show();
30 $('.rotor_tab', rotor_item).addClass('selected');
31 var contents = $('.rotor_content');
32 var actual = contents.get(actual_item);
33 actual_item = (actual_item + 1) % contents.length;
34 }
35
36 function wait_next_rotor() {
37 var contents = $('.rotor_content');
38 if(contents.length > 0) {
39 if (!rotor_interval) {
40 rotor_interval = setInterval(animate_rotor_item, rotor_time * 1000);
41 }
42 }
43 }

  ViewVC Help
Powered by ViewVC 1.1.2