Team:SydneyUni Australia/Scripts/mootools-1.2.1-core-yc
From 2013.igem.org
(Difference between revisions)
C.Squirrel (Talk | contribs) (Created page with "<html> <script type="text/javascript"> //MooTools, <http://mootools.net>, My Object Oriented (JavaScript) Tools. Copyright (c) 2006-2008 Valerio Proietti, <http://mad4milk.net>,...") |
C.Squirrel (Talk | contribs) |
||
Line 351: | Line 351: | ||
}});Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(A){this.parent(A);this.headers.extend({Accept:"application/json","X-Request":"JSON"}); | }});Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(A){this.parent(A);this.headers.extend({Accept:"application/json","X-Request":"JSON"}); | ||
},success:function(A){this.response.json=JSON.decode(A,this.options.secure);this.onSuccess(this.response.json,A);}}); | },success:function(A){this.response.json=JSON.decode(A,this.options.secure);this.onSuccess(this.response.json,A);}}); | ||
+ | |||
+ | |||
+ | window.addEvent('domready', function(){ | ||
+ | var transition = 'alternate'; | ||
+ | $$('input[name=transition]').addEvent('click', function(){ transition = this.value; }); | ||
+ | var slideAvailable = ['slide-left', 'slide-right', 'slide-top', 'slide-bottom', 'fade']; | ||
+ | var slideTransition = function(){ | ||
+ | switch(transition){ | ||
+ | case 'alternate': | ||
+ | if(! $defined(this.count)) this.count = -1; | ||
+ | return slideAvailable[++this.count % slideAvailable.length]; | ||
+ | case 'random': return slideAvailable.getRandom(); | ||
+ | default: return transition; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | $('option-auto').addEvent('click', function(){ | ||
+ | slideshow.options.auto = this.checked; | ||
+ | }); | ||
+ | |||
+ | var slideshow = new BarackSlideshow('menu', 'pictures', 'loading', { transition: 'slide-left', auto: false}); | ||
+ | |||
+ | // the example above is only fitting for this demo, since we let the user pick the transition and turn auto on/off | ||
+ | // for most scenarios, it's only enough with: | ||
+ | // new BarackSlideshow('menu', 'pictures', 'loading', {transition: '<transition here>', auto: true}); | ||
+ | // transitions can be 'slide-left', 'slide-right', 'slide-top', 'slide-bottom', 'fade' | ||
+ | }); | ||
</script> | </script> | ||
</html> | </html> |
Revision as of 05:47, 1 August 2013