所以; Open Source Code ORBIT Objects 设置添加随机默认false:
defaults: {
animation: 'horizontal-push',
animationSpeed: 600, // how fast animtions are
timer: true, // true or false to have the timer
advanceSpeed: 4000, // if timer is enabled, time between transitions
pauseOnHover: false, // if you hover pauses the slider
startClockOnMouseOut: false, // if clock should start on MouseOut
startClockOnMouseOutAfter: 1000,
directionalNav: true, // manual advancing directional navs
captions: true, // do you want captions?
captionAnimation: 'fade', // fade, slideOpen, none
captionAnimationSpeed: 600, // if so how quickly should they animate in
bullets: false,
bulletThumbs: false, // thumbnails for the bullets
bulletThumbLocation: '', // location from this file where thumbs will be
afterSlideChange: $.noop, // empty function
fluid: false,
centerBullets: true,
/////////////////////////// add Line
random: false, // or true
////////////////////////////
},
在 ORBIT Objects {loaded} 方法之后添加到 if (options.random) then Random:
loaded: function () {
this.$element
.addClass('orbit')
.css({width: '1px', height: '1px'});
this.setDimentionsFromLargestSlide();
this.updateOptionsIfOnlyOneSlide();
this.setupFirstSlide();
if (this.options.timer) {
this.setupTimer();
this.startClock();
}
if (this.options.captions) {
this.setupCaptions();
}
if (this.options.directionalNav) {
this.setupDirectionalNav();
}
if (this.options.bullets) {
this.setupBulletNav();
this.setActiveBullet();
}
//////////////////////////////// add Line
if (this.options.random)
this.shift(this.Random.__init__());
/////////////////////////////////////
},
后; 添加 ORBIT 对象新方法 {Random}
Random: {
__init__: function() {
return this.math();
},
math: function() {
var bullets_count = (jQuery(".orbit-bullets li").length -1);
return (Math.floor(Math.random() * (bullets_count - 0 + 1)));
}
},
别紧张..