Hide
Know what you're getting – Unlike many sites, all our code is clearly licensed. Join Siafoo Now or Learn More
Note: You are viewing an old version of this snippet. View Latest Version

Fading Content Rotator Using SharePoint Data Zoom Web Part Atom Feed 0

# 's
 1## Get the tasks list
2#set( $list = $web.lists.get_item("Testimonials") )
3
4## Get the items in the 'All Items' view
5#set( $itemsView = $list.Views.get_item("All Items") )
6#set( $listItems = $list.GetItems($itemsView ) )
7
8<style type="text/css">
9.attentionclass {
10 width:250px;
11 border:1px solid black;
12 text-align:center;
13 padding:10px 0 10px 0;
14 background-color:#FFFFFF;
15 color:#000000;
16 }
17</style>
18
19<script type="text/javascript">
20
21// The id of the div or other container with text to fade in/out.
22var containerId = 'attentionid';
23
24// In the color mask, put an 0 for the color digits that will change and otherwise for digits that will remain static.
25var colorMask = '#000000';
26
27// Specify the number of milliseconds to wait between each fade in/out step.
28var fadePause = 225;
29
30var currentContentIdx = 1;
31var totalContentItems = $listItems.Count;
32var previousContentIdx = totalContentItems;
33var pointer = 25;
34var numlist = "00000000000123456789ABCDEF".split("");
35var direction = 'up';
36var counter = 0;
37var maxChanges = 0;
38
39if( fadePause < 1 )
40 { fadePause = 1; }
41
42function fadeContentInOut() {
43 if( pointer == 25 )
44 { direction = 'down'; contentRotate(); }
45 else if( pointer == 0 )
46 { direction = 'up'; }
47 if( direction == 'up' )
48 { pointer++; }
49 else
50 { pointer--; }
51 counter++;
52 if( maxChanges > 0 && counter > maxChanges )
53 { clearInterval(Changing); }
54 re = /0/g;
55 var thiscolor = colorMask.replace(re,numlist[pointer]);
56 document.getElementById(containerId).style.color = thiscolor;
57}
58
59function contentRotate() {
60 var cid = "placeholderdiv_" + currentContentIdx;
61 document.getElementById(cid).style.display = 'block';
62 var lid = "placeholderdiv_" + previousContentIdx;
63 document.getElementById(lid).style.display = 'none';
64 previousContentIdx = currentContentIdx;
65 currentContentIdx = (currentContentIdx == totalContentItems ) ? 1 : currentContentIdx + 1;
66}
67
68setInterval("fadeContentInOut()", fadePause);
69
70</script>
71
72#foreach($item in $listItems)
73 #beforeall
74 <div id="attentionid">
75 #each
76 <div style="display:none;" id="placeholderdiv_${velocityCount}">$item.get_item('Quote')</div>
77 #afterall
78 </div>
79 #nodata
80 No quotes found.
81#end