/*
* realway javascript library
* copyright (c) 2014 realway
* email: realway@gmail.com
*/
$(document).ready(function(){
var itotal = [];
var ipage = [];
var istep = 0;
var olist = $('.album ul li');
var stype = ($('.album.rongyu').get(0))?('rongyu'):('');
var showimage = function(oimg){
var oalbum = oimg.parents('.album');
var iid = oalbum.attr('data-id');
if(stype=='rongyu'){
$('.album .full').html('
'+oimg.attr('title')+'
');
}else{
oalbum.find('.full').css({'background-image':'url('+oimg.attr('href')+')'});
oalbum.find('.full').attr('data-image', oimg.attr('href'));
oalbum.find('.full').attr('data-title', oimg.attr('title'));
};
oalbum.find('.overview h3').text(oimg.attr('title'));
oalbum.find('.overview span').html(oimg.html());
};
$('.album').each(function(){
var olist = $(this).find('ul li');
var iid = $(this).attr('data-id');
if(olist.size()){
istep = olist.eq(0).width();
itotal[iid] = olist.size();
ipage[iid] = 1;
olist.parent().css({'width':itotal*istep});
olist.find('a').eq(0).addclass('active');
showimage(olist.find('a').eq(0));
};
});
$('a.prev, a.next').click(function(){
var stype = $(this).attr('data-type');
var oalbum = $(this).parents('.album');
var iid = oalbum.attr('data-id');
var oframe = oalbum.find('nav ul');
if(stype=="prev" && ipage[iid]>1){
ipage[iid]--;
oframe.animate({'margin-left':'+='+istep});
}
else if(stype=="next" && ipage[iid]