Introducing Protocycle, an easy way to fade between images

Protocycle is a new plugin for the Prototype JavaScript framework. Use it to fade between different sets of images, paragraphs of text, in fact anything you like.

28th July 2009 published by James Moss

Protocycle in action on the Fly Spain homepageThe Prototype framework takes the hassle out of writing non-obtrusive, cross browser JavaScript. By extending the DOM with easy to use methods and classes its easy to create a great user interface or just add a bit of polish to an existing webpage.

In a recent project we needed a way to quickly fade between images just like the jQuery plugin jCycle. After a bit of searching we found there was nothing which matched our requirements.  We needed a simple, lightweight Prototype/ Scriptaculous plugin which didnt need additional CSS files or complex JavaScript and would degrade gracefully.  In the end we wrote Protocycle, based on jCycle, it's probably the easiest way to get a set of html elements fading between one another.

Firstly to see the plugin in action, take a look at the banner images on the Fly Spain website.

It's straightforward to get things working, include the required JavaScript files (prototype.js, scriptaculous.js, protocycle.min.js) in the head of your page and just create an instance of the class inside the ondomready event handler like so:

document.observe("dom:loaded", function(){
    new Protocycle('ul.container');
});

Protocycle will automatically take the first descendants of the element you pass into it and start fading between them. You can pass in a string containing a CSS selector, an array of HTMLElements or a single HTMLElement.

It's also possible to pass an object as a second parameter containing options to customise the functionality of Protocycle, like so

document.observe("dom:loaded", function(){
    new Protocycle('ul.container', {timeout: 6000, speed: 2000});
})
;

The options in this example tell Protocycle to wait 6 seconds between fades and take 2 seconds to perform the fade animations.  There are other options which can be specified, see the source file for more details. We've tried to keep the names of the options in line with jCycle but to keep things lightweight not everything is supported.

Download Protocycle (minified version) (2kb)

Download Protocycle (full source code) (4kb)

(Protocycle requires Prototype 1.6+ and Scriptaculous 1.8.2+)

Please leave any feedback in the comments below.

 

Regards, James

Tagged under: CMS, Prototype, Javascript, System features, Design

Related news

Fly Spain's new paragliding website design reaches dizzy heights

Fly Spain's new paragliding website design reaches dizzy heights

After 4 years the original production of the site had become a little exhausted as it does when you work within the constraints of a site for a number of years, so we needed to shakes things and add some new life.

14th Jul 2009

Read more…

Jeremy's Restaurant website design change is simple yet effective

Jeremy's Restaurant website design change is simple yet effective

Having originally designed the restaurant website 4 years ago, everyone was pleased with how well it had lasted but needed to make some changes moving the website on to the next level.

23rd Jul 2009

Read more…

Comments

Nobody has commented on this article yet.

Add your comments

Collaborate here!

If your a writer of blogs and think that our audience would enjoy something you've written please send us your details. We're always happy to publish great content.

The website is now really working extremely well for us, generating an increasing number of bookings and enquiries as well as providing an information platform for new customers looking for fine dining in Sussex.

Sarah Fiedsouk

Marketing Manager

Jeremy's Restaurant

With Solv.it's help in a week, I could preview all the pages on the website I created. Fantastic. My website is now alive, thanks to Kevin and his team.

Emmanuel A Odame

Business Owner

Efamy Chilli Sauce

We have been looking for a way to deliver cost effective high functionality websites for our customers for years. We had all but given up until we discovered the Solv.it CMS system.

Martin Henley

Business Owner

Effective Marketing Company

Solv. IT has always been incredibly supportive and flexible throughout our long-term relationship. They undoubtedly represent value for money.

Bryn Rettie

Consultant

MSB Consultancy

The content management system is fantastically simply, yet powerful, and they were highly responsive. I really can’t recommend Solv.It or its services highly enough.

Michael Nicholas

Author, Coach, Leadership Expert

Optimal Track

At the beginning you described in detail but also in lay-man terms how the components of the website would come together.

Gordon White

Business Owner

GK Whites Estate Agents

Being from a non-IT background, I found the one to one training session provided by Kevin Collins (Managing Director) to be very helpful, practical and essential to having the confidence to manage this website.

Paull Smyth

Website Administrator

Jiva Solicitors

They have taken time to fully understand our sometimes difficult and confusing business brief and delivered an excellent product.

Stephen Vokins

Business Owner

Big Brand Beds

Solv It has provided the tools, knowledge and guidance to improve our website presence in a highly competitive market place.

Steve Molloy

Marketing Manager

Antony Hodari Solicitors

Solv-it trained me to upload information from our agency system to the website and everything was very simply put and I have no problem updating our website every day.

Alison Crawford

Website Administrator

Wheelers Estate Agents

Solvit have offered advice and caution when planning our website. Not concerned with flashy upgrades necessarily but content, functionality and realtime Market response.

Rob Mansley

Business Owner

Fly Spain Paragliding

 Attention: all website owners

"We provide businesses with expert knowledge, guidance, training and support

GUARANTEED

to maximise the return on their website investment.

We can save you time, money and a whole lot of frustration with your website prooduction, safe in the knowledge that help is close at hand as and when required."


Kevin Collins

Managing Director

Website success stories

Page through the following examples to read case studies or, visit our gallery of websites.

  • Wheelers Estate Agents

    Wheelers Estate Agents

    This exclusive Brighton estate agents situated in the remote location of Hanover, requires maximum exposure from their website to ensure brand awareness in a highly competitive market.

    Read case study »

  • Sussex County Cricket Club

    Sussex County Cricket Club

    The County team use their flexible, content managed website to respond fast to the latest events - like winning the Championship!

    Read case study »

  • GK Whites Estate Agents

    GK Whites Estate Agents

    With their original website being more than 8 years old, this Brighton lettings agent had a number of goals to achieve with their new website design and production.

    Read case study »

  • Antony Hodari Solicitors

    Antony Hodari Solicitors

    Recognising that it takes more than a new website design to compete online with other solictor websites, Antony Hodari Solicitors were eager to take full control over their content publication.

    Read case study »

  • Jeremy's Restaurant

    Jeremy's Restaurant

    When Jeremy's Restaurant set their sights on becoming the leading fine dining destination in Sussex, they chose Solv.IT to meet their marketing needs.

    Read case study »

     

  • MSB Consultancy

    MSB Consultancy

    Customer service consultants MSB were looking to reinforce their existing branded materials online with their new website, which now has a very contemporary look and feel.

    Read case study »

  • Fly Spain Paragliding

    Fly Spain Paragliding

    Being based in Spain the web is an imperative part of the marketing mix for this thriving family business, attracting new prospects through their website and continued dialog with loyal customers using email messaging.

    Read case study »

  • Mishon Mackay Estate Agents

    Mishon Mackay Estate Agents

    Client and property details, website content, window displays, advertising copy, reports and automated directory listings - all a click away for mishon mackay.

    Read case study »

  • Big Brand Beds

    Big Brand Beds

    Brighton's historic retail brand Vokins@home develop an e-commerce website solution to sell their full range of branded divan beds, bedsteads and mattresses online.

    Read case study »

Sign up

Join our mail list to receive our monthly newsletter about industry advances, system features and improved services.