> > | Scroll Box Add-on
<--
Contributions to this add-on are appreciated. Please update the add-on page at
http://twiki.org/cgi-bin/view/Plugins/ScrollBoxAddOn or provide feedback at
http://twiki.org/cgi-bin/view/Plugins/ScrollBoxAddOnDev.
If you are a TWiki contributor please update the add-on in the SVN repository.
-->
Add scroll boxes, image rotation and static boxes to TWiki pages
Introduction
Use this add-on to create nice looking text scroll boxes, logo rolls and boxes with images that get replaced in regular intervals. Scrolling stops if you hover the mouse pointer over the scroll area.
This add-on uses CSS and JavaScript. It falls back to show initial content in case JavaScript is not available. All code is included, e.g. there are no external dependencies. The Scroll Box Add-on is inspired by the scrolling content script of dhtmlgoodies.com.
The twiki.org redesign of December 2010 added a logo roll to the homepage. This add-on was created based on that work.
Usage
There are two options to create scroll boxes:
- Using INCLUDE
- Using HTML & CSS
Scroll Box Using INCLUDE
Create scroll boxes in TWiki pages by including two named sections defined in the ScrollBoxAddOn topic, called "scroll_box_engine" and "scroll_box" , respectively. Example:
%INCLUDE{ "%SYSTEMWEB%.ScrollBoxAddOn" section="scroll_box_engine" }%
%INCLUDE{ "%SYSTEMWEB%.ScrollBoxAddOn" section="scroll_box"
name="must_be_unique"
title="This is a test"
content="TWiki keeps getting more and more useful."
delay="100"
vstep="1"
width="400"
height="30"
}%
The "scroll_box_engine" section defines the CSS and JavaScript. It must be included once per page.
The "scroll_box" section generates a scroll box. It can be included more than once on a page to create multiple scroll boxes. Parameters of "scroll_box" section:
Parameter |
Description |
Default |
name |
Name of the box. Must be unique per page. Use only alphanumeric characters and underscore! |
(none) |
title |
Title of the box. |
(no title) |
content |
Content of the box. Can be of any form, such as TML, HTML, images. Make sure to escape double quotes with a backslash, such as <br clear=\"all\"> . |
(none) |
delay |
Delay between scrolls, in milliseconds. |
"1000" |
vstep |
Vertical step taken per scroll, in pixels. |
(container height) |
width |
Box width, in pixels. |
"300" |
height |
Box height of scrollable area, in pixels. |
"40" |
boxstyle |
CSS of outer box. |
"border: solid #d0d0d0 1px; padding: 15px;" |
titlestyle |
CSS of title. |
"text-align:center; font-size:19px; font-weight:bold; color: #333335; padding:0 0 12px 0; white-space: nowrap; overflow: hidden;" |
contentstyle |
CSS of content. |
"text-align: justify;" |
Scroll Box Using HTML & CSS
You can define your own style and create your own scroll box. Example:
%INCLUDE{ "%SYSTEMWEB%.ScrollBoxAddOn" section="scroll_box_engine" }% <!-- once per page -->
<div id="myOwnBoxContainer">
<div id="myOwnBoxContent">
(put content here)
</div><!-- id="myOwnBoxContent" -->
</div><!-- id="myOwnBoxContainer" -->
<script type="text/javascript">
initScrollBox( 'myOwnBoxContainer', 100, 1, 200, 400 );
</script>
The first parameter of initScrollBox() is the ID of the div that contains the scroll box. The numeric parameters are delay , vstep , width and height , respectively.
Static Box Using INCLUDE
Create static boxes in TWiki pages by including two named sections defined in the ScrollBoxAddOn topic, called "scroll_box_engine" and "static_box" , respectively. Example:
%INCLUDE{ "%SYSTEMWEB%.ScrollBoxAddOn" section="scroll_box_engine" }%
%INCLUDE{ "%SYSTEMWEB%.ScrollBoxAddOn" section="static_box"
title="Nice box"
content="Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
width="400"
height="225"
}%
The "scroll_box_engine" section defines the CSS and JavaScript. It must be included once per page.
The "static_box" section generates a static box. It can be included more than once on a page to create multiple boxes. Parameters of "static_box" section:
Parameter |
Description |
Default |
title |
Title of the box. |
(no title) |
content |
Content of the box. Can be of any form, such as TML, HTML, images. Make sure to escape double quotes with a backslash, such as <br clear=\"all\"> . |
(none) |
width |
Box width, in pixels. |
"300" |
height |
Height of content, in pixels. |
(auto) |
boxstyle |
CSS of outer box. |
"border: solid #d0d0d0 1px; padding: 15px;" |
titlestyle |
CSS of title. |
"text-align:center; font-size:19px; font-weight:bold; color: #333335; padding:0 0 12px 0; white-space: nowrap; overflow: hidden;" |
contentstyle |
CSS of content. |
(none) |
Static Box Using 2 INCLUDEs
This is an alternative to the previous example. The box is split up into two INCLUDEs with a "static_box_start" section, the box content, and a "static_box_end" section. Example:
%INCLUDE{ "%SYSTEMWEB%.ScrollBoxAddOn" section="scroll_box_engine" }%
%INCLUDE{ "%SYSTEMWEB%.ScrollBoxAddOn" section="static_box_start"
title="Nice box"
width="400"
height="225"
}%
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.
%INCLUDE{ "%SYSTEMWEB%.ScrollBoxAddOn" section="static_box_end" }%
The "scroll_box_engine" section defines the CSS and JavaScript. It must be included once per page.
The "static_box_start" section generates the start of a static box. Parameters of "static_box_start" section:
Parameter |
Description |
Default |
title |
Title of the box. |
(no title) |
width |
Box width, in pixels. |
"300" |
height |
Height of content, in pixels. |
(auto) |
boxstyle |
CSS of outer box. |
"border: solid #d0d0d0 1px; padding: 15px;" |
titlestyle |
CSS of title. |
"text-align:center; font-size:19px; font-weight:bold; color: #333335; padding:0 0 12px 0; white-space: nowrap; overflow: hidden;" |
contentstyle |
CSS of content. |
(none) |
The "static_box_end" section generates the end of the static box. Pairs of "static_box_start" and "static_box_end" section INCLUDEs can be done on a page to create multiple boxes.
Named sections
This section defines the named sections "scroll_box_engine" , "scroll_box" , "static_box" , "static_box_start" and "static_box_end" . View the raw text of this topic to look under the hood.
<--=========================================================
=========================================================
=========================================================
=========================================================
==========================================================-->
Examples
Text scroll demo
This example shows a box that scrolls text in one pixel increments.
How it works: We place the text in a scrollable canvas that is 300 pixels wide. The text is justified left and right as specified in the style sheet of the scroll box content. We tell the scroll box to show a container 300 pixels wide and 150 pixels high. That is, we only see part of the canvas. We move the canvas up 1 pixel at a time and to wait 100 milliseconds between steps, e.g. we get the impression of smoothly scrolling text in the container.
Rendered text scroll:
Lorem ipsum
<-- make space on top -->
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
| |
Raw text:
%INCLUDE{ "%SYSTEMWEB%.ScrollBoxAddOn" section="scroll_box_engine" }%
%INCLUDE{
"%SYSTEMWEB%.ScrollBoxAddOn"
section="scroll_box"
name="textExample"
title="Lorem ipsum"
content="<br /><!-- make space on top -->
Lorem ipsum dolor sit amet, consectetur
...
deserunt mollit anim id est laborum."
delay="100"
vstep="1"
width="300"
height="150"
}%
|
Logo roll demo
This example shows a logo roll that changes every 2 seconds.
How it works: We have a set of logos that all have the same height of 30 pixels:
We place the logos in a scrollable canvas that is 300 pixels wide. The logos wrap around; they are justified left and right as specified in the style sheet of the scroll box content. We tell the scroll box to step by 30 pixels at a time, e.g. we will cycle through the logos row by row because the icons are 30 pixels high.
Note: It is important to specify the width and height of the images, or scrolling might not work on some browsers. Browsers need to know the total scrollable area before all images are loaded.
Rendered logo roll:
| |
Raw text:
%INCLUDE{ "%SYSTEMWEB%.ScrollBoxAddOn" section="scroll_box_engine" }%
%INCLUDE{
"%SYSTEMWEB%.ScrollBoxAddOn"
section="scroll_box"
name="logoExample"
title="TWiki Users Around the Globe"
content="<img src='%ATTACHURLPATH%/com-cisco.png' alt='cisco' width='56' height='30' />
<img src='%ATTACHURLPATH%/com-hp.png' alt='hp' width='43' height='30' />
...
<img src='%ATTACHURLPATH%/com-cmu.png' alt='cmu' width='117' height='30' />"
delay="2000"
vstep="30"
width="300"
height="30"
}%
|
Image swap demo
This example shows a box containing an image that get replaced every 3 seconds.
How it works: The images are 300 pixels wide and 225 pixels high. We place the images in a scrollable canvas that is 300 pixels wide, e.g. one image fits on each "line". In other words, the images are stacked on top of each other. We tell the scroll box to step by 225 pixels at a time, e.g. the same as the image height. This results in cycling through the images one by one.
Note: It is important to specify the width and height of the images, or scrolling might not work on some browsers. Browsers need to know the total scrollable area before all images are loaded.
Rendered image box:
| |
Raw text:
%INCLUDE{ "%SYSTEMWEB%.ScrollBoxAddOn" section="scroll_box_engine" }%
%INCLUDE{
"%SYSTEMWEB%.ScrollBoxAddOn"
section="scroll_box"
name="imageExample"
title="Beverly Hills"
content="<img src='%ATTACHURLPATH%/Dsc08566.jpg' alt='Beverly Hills' width='300' height='225' />
<img src='%ATTACHURLPATH%/Dsc08581.jpg' alt='Rodeo Drive' width='300' height='225' />
<img src='%ATTACHURLPATH%/Dsc08580.jpg' alt='Expensive cars' width='300' height='225' />
<img src='%ATTACHURLPATH%/Dsc08567.jpg' alt='Beverly Hills City Hall' width='300' height='225' />"
delay="3000"
vstep="225"
width="300"
height="225"
}%
|
Static box demo
Rendered static box:
| |
Raw text:
%INCLUDE{ "%SYSTEMWEB%.ScrollBoxAddOn" section="scroll_box_engine" }%
%INCLUDE{
"%SYSTEMWEB%.ScrollBoxAddOn"
section="static_box"
title="Nice box"
content="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat."
width="300"
contentstyle="text-align: justify;"
}%
|
Same static box, alternative syntax:
| |
Raw text:
%INCLUDE{ "%SYSTEMWEB%.ScrollBoxAddOn" section="scroll_box_engine" }%
%INCLUDE{ "%SYSTEMWEB%.ScrollBoxAddOn" section="static_box_start"
title="Nice box" width="300" contentstyle="text-align: justify;" }%
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat.
%INCLUDE{ "%SYSTEMWEB%.ScrollBoxAddOn" section="static_box_end" }%
|
Installation Instructions
Note: You do not need to install anything on the browser to use this add-on. The following instructions are for the administrator who installs the add-on on the TWiki server.
<--/twistyPlugin twikiMakeVisibleInline-->
- Download the ZIP file from the Add-on Home (see below)
- Unzip
ScrollBoxAddOn.zip in your twiki installation directory. Content: File: | Description: | data/TWiki/ScrollBoxAddOn.txt | Add-on topic | pub/TWiki/ScrollBoxAddOn/* | Images used by the examples |
- Test if the installation was successful:
- See if above examples work
<--/twistyPlugin-->
Add-On Info
- Set SHORTDESCRIPTION = Add scroll boxes, image rotation and static boxes to TWiki pages
Add-on Author: |
TWiki:Main.PeterThoeny |
Copyright: |
© 2012-2013 TWiki:Main.PeterThoeny |
License: |
GPL (GNU General Public License) |
Add-on Version: |
2013-10-11 |
<--/twistyPlugin twikiMakeVisibleInline-->
2013-10-11: |
TWikibug:Item7328: Fix for ScrollBoxAddOn not working on IE9 -- TWiki:Main.YaojunFei |
2013-05-04: |
TWikibug:Item7154: Document need to specify image width & height; add Twisty to history and installation section |
2012-10-14: |
TWikibug:Item6985: Dark link colors in scroll box titles |
2012-10-12: |
TWikibug:Item6971: Add ScrollBoxAddOn to core distribution |
2012-10-04: |
TWikibug:Item6956: CSS based box shadow and rounded corners |
2012-05-14: |
TWikibug:Item6837: Add non-scrolling box feature with "static_box*" sections; change padding from 10px to 15px; add boxstyle, titlestyle and contentstyle parameters |
2011-02-10: |
TWikibug:Item6638: Avoid <p /> tag when including scroll box engine |
2011-01-25: |
TWikibug:Item6638: Small style change: More padding below title |
2010-12-23: |
TWikibug:Item6623: Doc improvements; changing function initScrollContent to initScrollBox |
2010-12-22: |
TWikibug:Item6623: Initial version |
<--/twistyPlugin-->
Related Topic: TWikiAddOns
META FILEATTACHMENT |
attachment="gradient-title.png" attr="h" comment="" date="1349373319" name="gradient-title.png" path="gradient-title.png" size="249" user="TWikiContributor" version="1" |
META FILEATTACHMENT |
attachment="com-cisco.png" attr="h" comment="" date="1293056897" name="com-cisco.png" path="com-cisco.png" size="2873" user="TWikiContributor" version="1" |
META FILEATTACHMENT |
attachment="com-fedex.png" attr="h" comment="" date="1293056897" name="com-fedex.png" path="com-fedex.png" size="7147" user="TWikiContributory" version="1" |
META FILEATTACHMENT |
attachment="com-google.png" attr="h" comment="" date="1293056897" name="com-google.png" path="com-google.png" size="7014" user="TWikiContributor" version="1" |
META FILEATTACHMENT |
attachment="com-ebay.png" attr="h" comment="" date="1293056897" name="com-ebay.png" path="com-ebay.png" size="2407" user="TWikiContributor" version="1" |
META FILEATTACHMENT |
attachment="com-nasa.png" attr="h" comment="" date="1293056897" name="com-nasa.png" path="com-nasa.png" size="6270" user="TWikiContributor" version="1" |
META FILEATTACHMENT |
attachment="com-sony.png" attr="h" comment="" date="1293056897" name="com-sony.png" path="com-sony.png" size="1786" user="TWikiContributor" version="1" |
META FILEATTACHMENT |
attachment="com-ubs.png" attr="h" comment="" date="1293056897" name="com-ubs.png" path="com-ubs.png" size="6919" user="TWikiContributor" version="1" |
META FILEATTACHMENT |
attachment="com-intel.png" attr="h" comment="" date="1293057389" name="com-intel.png" path="com-intel.png" size="1752" user="TWikiContributor" version="1" |
META FILEATTACHMENT |
attachment="com-motorola.png" attr="h" comment="" date="1293057389" name="com-motorola.png" path="com-motorola.png" size="2059" user="TWikiContributor" version="1" |
META FILEATTACHMENT |
attachment="com-hp.png" attr="h" comment="" date="1293057389" name="com-hp.png" path="com-hp.png" size="6157" user="TWikiContributor" version="1" |
META FILEATTACHMENT |
attachment="com-cmu.png" attr="h" comment="" date="1293057389" name="com-cmu.png" path="com-cmu.png" size="5976" user="TWikiContributor" version="1" |
META FILEATTACHMENT |
attachment="Dsc08566.jpg" attr="h" comment="" date="1293062933" name="Dsc08566.jpg" path="Dsc08566.jpg" size="27845" user="TWikiContributor" version="1" |
META FILEATTACHMENT |
attachment="Dsc08581.jpg" attr="h" comment="" date="1293062933" name="Dsc08581.jpg" path="Dsc08581.jpg" size="27620" user="TWikiContributor" version="1" |
META FILEATTACHMENT |
attachment="Dsc08580.jpg" attr="h" comment="" date="1293062932" name="Dsc08580.jpg" path="Dsc08580.jpg" size="27677" user="TWikiContributor" version="1" |
META FILEATTACHMENT |
attachment="Dsc08567.jpg" attr="h" comment="" date="1293062932" name="Dsc08567.jpg" path="Dsc08567.jpg" size="27688" user="TWikiContributor" version="1" |
|