How to Create Image Gallery/Slideshow with noobSlide (1)
Noobslide is a MooTools based javascript library allows you to create a web-based image gallery or slideshow easily. (MooTools is a compact JavaScript framework designed for intermediate to advanced JavaScript developer.)
To download the noobslide code, one can refer to the official website here. The package contains the MooTools script, the noobSlide script, two css files, a couple of images and a sample page.
The examples provided are quite easy to understand, here we illustrate two examples, sample 2 and sample 7.
To get started, one need to include the javascript library and the CSS files in the head part of the html page.
<link rel="stylesheet" href="_web.css" type="text/css" media="screen" />
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<script type="text/javascript" src="mootools-1.2-core.js"></script>
<script type="text/javascript" src="_class.noobSlide.packed.js"></script>
Sample 2
In the body of the html page, one needs to include the following html code,
<div id="cont">
<div class="sample">
<div class="mask2">
<div id="box2">
<span><img src="img1.jpg" alt="Photo" /></span>
<span><img src="img2.jpg" alt="Photo" /></span>
<span><img src="img3.jpg" alt="Photo" /></span>
<span><img src="img4.jpg" alt="Photo" /></span>
<span><img src="img5.jpg" alt="Photo" /></span>
<span><img src="img6.jpg" alt="Photo" /></span>
<span><img src="img7.jpg" alt="Photo" /></span>
<span><img src="img8.jpg" alt="Photo" /></span>
</div>
</div>
<p class="buttons">
<span id="prev1"><< Previous</span>
<span id="play1">Play ></span>
<span id="stop1">Stop</span>
<span id="next1">Next >></span>
</p>
</div>
</div>
The code should be clear and easy to understand.
Then in the head part, we call javascript function defined in noobSlide library to achieve the slideshow effects.
<script type="text/javascript">
window.addEvent('domready',function(){
//SAMPLE 2 (transition: Bounce.easeOut)
var nS2 = new noobSlide({
box: $('box2'),
items: [0,1,2,3,4,5,6,7],
interval: 3000,
fxOptions: {
duration: 1000,
transition: Fx.Transitions.Bounce.easeOut,
wait: false
},
addButtons: {
previous: $('prev1'),
play: $('play1'),
stop: $('stop1'),
next: $('next1')
},
autoPlay:true
});
});
</script>
The autoPlay parameter set to true will let the slideshow start automatically once the page is loaded.
You can view the effect of the sample here (as a separate page) or below.
Sample 7
In the body part, insert the following html code,
<div id="cont">
<div class="sample">
<div class="mask6">
<div id="box7">
<span><img src="img1.jpg" alt="Photo" style="width:300;"/></span>
<span><img src="img2.jpg" alt="Photo" style="width:300;"/></span>
<span><img src="img3.jpg" alt="Photo" style="width:300;"/></span>
<span><img src="img4.jpg" alt="Photo" style="width:300;"/></span>
</div>
</div>
<div id="thumbs7">
<div class="thumbs">
<div><img src="img1.jpg" alt="Photo Thumb" /></div>
<div><img src="img2.jpg" alt="Photo Thumb" /></div>
<div><img src="img3.jpg" alt="Photo Thumb" /></div>
<div><img src="img4.jpg" alt="Photo Thumb" /></div>
</div>
<div id="thumbs_mask7"></div>
<p id="thumbs_handles7">
<span></span>
<span></span>
<span></span>
<span></span>
</p>
</div>
</div>
</div>
Then in the head part of the html page, insert the JavaScript code,
<script type="text/javascript">
window.addEvent('domready',function(){
//SAMPLE 7
var startItem = 3; //or 0 or any
var thumbs_mask7 = $('thumbs_mask7').setStyle('left',(startItem*100-550)+'px').set('opacity',0.8);
var fxOptions7 = {property:'left',duration:1000, transition:Fx.Transitions.Back.easeOut, wait:false}
var thumbsFx = new Fx.Tween(thumbs_mask7,fxOptions7);
var nS7 = new noobSlide({
box: $('box7'),
items: [0,1,2,3],
size: 300,
handles: $$('#thumbs_handles7 span'),
fxOptions: fxOptions7,
onWalk: function(currentItem){
thumbsFx.start(currentItem*100-550);
},
startItem: startItem,
autoPlay:true
});
//walk to first with fx
nS7.walk(0);
});
</script>
Note that if you want to adjust the image or thumbnail size, there’re a few places needs to be changed, including the size parameter value and several places in the style.css file. Also, the thumbs_mask.gif file needs to resized properly to fit the thumbnail size you want.
You can refer here (as a separate page) or below for the effect of sample 7.
You can refer here for another sample.
Leave a Reply Cancel reply
40% Discount on My Book — Android NDK Cookbook
Android NDK Cookbook ebook 40% discount with promotion code MREANC40 at Packt Publishing The promotion code is valid until 15th June.Categories
- Android Apps (18)
- Android Audio Editor (1)
- TS 2 (3)
- Video Converter Android (8)
- Video2Gif (1)
- Android Tutorial (26)
- Android Dev Tools (1)
- API illustrated (8)
- Multimedia API (3)
- ffmpeg on Android (4)
- NDK (6)
- UI (5)
- Animation (1)
- Code Snippet (2)
- Coding Beyond Technique (18)
- a word, a world (4)
- Bug Rectified (4)
- Programming Habit (1)
- Software as a Career (1)
- Software as User Experience (1)
- Compilers and Related (2)
- ELF (2)
- Computer Languages (31)
- C/C++ (13)
- Java (9)
- JavaScript (2)
- PHP (1)
- Python (8)
- Data Structure & Algorithms (29)
- Bits (1)
- Data Structure (5)
- Integers (10)
- BigInteger (1)
- Prime (4)
- Search (3)
- Sorting (5)
- Strings (5)
- Database (1)
- SQLite (1)
- Digital Signal Processing (33)
- Distributed Systems (17)
- Apache Cassandra (6)
- Apache Hadoop (8)
- Apache Avro (3)
- Apache Nutch (3)
- Apache Solr (1)
- Linux Study Notes (40)
- crontab (1)
- Linux Kernel Programming (8)
- Linux Programming (12)
- IPC (2)
- Linux Network Programming (5)
- Linux Signals (2)
- Linux Shell Scripting (1)
- ssh (3)
- Machinery (30)
- misc (1)
- My Ideas (1)
- My Project (3)
- Mobile Caching (1)
- Selective Decoding (2)
- My Publication (1)
- My Readings (1)
- Networking (15)
- Program for Performance (8)
- Uncategorized (1)
- Virtual Machine (2)
- Web Dev (8)
- web components (3)
- Android Apps (18)
Recent Comments
Archives
- May 2013 (1)
- April 2013 (1)
- March 2013 (4)
- December 2012 (2)
- November 2012 (6)
- October 2012 (6)
- September 2012 (3)
- August 2012 (13)
- July 2012 (15)
- June 2012 (3)
- May 2012 (8)
- April 2012 (4)
- March 2012 (13)
- February 2012 (19)
- January 2012 (9)
- December 2011 (11)
- November 2011 (12)
- October 2011 (4)
- September 2011 (12)
- August 2011 (16)
- July 2011 (15)
- June 2011 (6)
- May 2011 (10)
- April 2011 (13)
- March 2011 (20)
- February 2011 (4)
- November 2010 (2)
- May 2010 (1)
- April 2010 (1)
- February 2010 (1)




