').append($templateimg.clone()).html() //get HTML of first matching image
srcs = [$templateimg.attr('src'), $templateimg.attr('data-over'), $templateimg.attr('data-select')] //remember control's over and out, and selected image src
for (var i = 0; i < asize; i++) {
var moveto = Math.min(i * moveby, config.lastvisiblepanel)
imgarray.push(imghtml.replace(/>$/, ' data-index="' + i + '" data-moveto="' + moveto + '" title="Move to Panel ' + (moveto + 1) + '">') + '\n')
controlpoints.push(moveto) //store panel index each control goes to when clicked on
}
var $controls = $('
').replaceAll($templateimg).append(imgarray.join('')).find('img') //replace template link with links and return them
$controls.css({ cursor: 'pointer' })
config.$paginatediv.bind('click', function (e) {
var $target = $(e.target)
if ($target.is('img') && $target.attr('data-over')) {
stepcarousel.stepTo(config.galleryid, parseInt($target.attr('data-moveto')) + 1)
}
})
config.$paginatediv.bind('mouseover mouseout', function (e) {
var $target = $(e.target)
if ($target.is('img') && $target.attr('data-over')) {
if (parseInt($target.attr('data-index')) != config.pageinfo.curselected) //if this isn't the selected link
$target.attr('src', srcs[(e.type == "mouseover") ? 1 : 0])
}
})
config.pageinfo = { controlpoints: controlpoints, $controls: $controls, srcs: srcs, prevselected: null, curselected: null }
}
},
selectpaginate: function ($, galleryid) {
var config = stepcarousel.configholder[galleryid]
if (config.$paginatediv.length == 1) {
for (var i = 0; i < config.pageinfo.controlpoints.length; i++) {
if (config.pageinfo.controlpoints[i] <= config.currentpanel) //find largest control point that's less than or equal to current panel shown
config.pageinfo.curselected = i
}
if (typeof config.pageinfo.prevselected != null) //deselect previously selected link (if found)
config.pageinfo.$controls.eq(config.pageinfo.prevselected).attr('src', config.pageinfo.srcs[0])
config.pageinfo.$controls.eq(config.pageinfo.curselected).attr('src', config.pageinfo.srcs[2]) //select current paginate link
config.pageinfo.prevselected = config.pageinfo.curselected //set current selected link to previous
}
},
loadcontent: function (galleryid, url) {
var config = stepcarousel.configholder[galleryid]
config.contenttype = ['ajax', url]
stepcarousel.stopautostep(config)
stepcarousel.resetsettings($, config)
stepcarousel.init(jQuery, config)
},
init: function ($, config) {
config.gallerywidth = config.$gallery.width()
config.offsets = { left: stepcarousel.getoffset(config.$gallery.get(0), "offsetLeft"), top: stepcarousel.getoffset(config.$gallery.get(0), "offsetTop") }
config.$belt = config.$gallery.find('.' + config.beltclass) //Find Belt DIV that contains all the panels
config.$panels = config.$gallery.find('.' + config.panelclass) //Find Panel DIVs that each contain a slide
config.panelbehavior.wrapbehavior = config.panelbehavior.wrapbehavior || "pushpull" //default wrap behavior to "pushpull"
config.$paginatediv = $('#' + config.galleryid + '-paginate') //get pagination DIV (if defined)
if (config.autostep)
config.autostep.pause += config.panelbehavior.speed
config.onpanelclick = (typeof config.onpanelclick == "undefined") ? function (target) { } : config.onpanelclick //attach custom "onpanelclick" event handler
config.onslideaction = (typeof config.onslide == "undefined") ? function () { } : function (beltobj) { $(beltobj).stop(); config.onslide() } //attach custom "onslide" event handler
config.oninit = (typeof config.oninit == "undefined") ? function () { } : config.oninit //attach custom "oninit" event handler
config.beltoffset = stepcarousel.getCSSValue(config.$belt.css('marginLeft')) //Find length of Belt DIV's left margin
config.statusvars = config.statusvars || [] //get variable names that will hold "start", "end", and "total" slides info
config.$statusobjs = [$('#' + config.statusvars[0]), $('#' + config.statusvars[1]), $('#' + config.statusvars[2])]
config.currentpanel = 0
stepcarousel.configholder[config.galleryid] = config //store config parameter as a variable
if (config.contenttype[0] == "ajax" && typeof config.contenttype[1] != "undefined") //fetch ajax content?
stepcarousel.getremotepanels($, config)
else
stepcarousel.alignpanels($, config) //align panels and initialize gallery
},
resetsettings: function ($, config) {
config.$gallery.unbind()
config.$belt.stop()
config.$panels.remove()
if (config.$leftnavbutton) {
config.$leftnavbutton.remove()
config.$rightnavbutton.remove()
}
if (config.$paginatediv.length == 1) {
config.$paginatediv.unbind()
config.pageinfo.$controls.eq(0).attr('src', config.pageinfo.srcs[0]).removeAttr('data-index').removeAttr('data-moveto').removeAttr('title') //reset first pagination link so it acts as template again
.end().slice(1).remove() //then remove all but first pagination link
}
if (config.autostep)
config.autostep.status = null
if (config.panelbehavior.persist) {
stepcarousel.setCookie(window[config.galleryid + "persist"], 0) //set initial panel to 0, overridden w/ current panel if window.unload is invoked
}
},
setup: function (config) {
//Disable Step Gallery scrollbars ASAP dynamically (enabled for sake of users with JS disabled)
document.write('')
jQuery(document).ready(function ($) {
config.$gallery = $('#' + config.galleryid)
stepcarousel.init($, config)
}) //end document.ready
jQuery(window).bind('unload', function () { //clean up on page unload
stepcarousel.resetsettings($, config)
if (config.panelbehavior.persist)
stepcarousel.setCookie(config.galleryid + "persist", config.currentpanel)
jQuery.each(config, function (ai, oi) {
oi = null
})
config = null
})
}
}
document.write("
");
stepcarousel.setup({
galleryid: 'mygallery',
beltclass: 'belt',
panelclass: 'panel',
panelbehavior: { speed: 500, wraparound: true, wrapbehavior: 'pushpull', persist: false },
defaultbuttons: { enable: false, moveby: 1, leftnav: ['arrowl.gif', -10, 100], rightnav: ['arrowr.gif', -10, 100] },
statusvars: ['reportA', 'reportB', 'reportC'],
contenttype: ['inline']
});