Created
May 30, 2009 15:04
-
-
Save coolniikou/120527 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.slidergallery = function(options) { | |
var defaults = { | |
baseurl: 'http://example.com/jsondata_address', | |
speed: 'slow', | |
timeout: 1500, | |
type: 'sequence' | |
}; | |
var options = $.extend(defaults, options); | |
return this.each(function() { | |
var obj = $(this); | |
var tabs = $('ul li a', obj); | |
var tabContent = $('div',obj); | |
tabs.bind('click', onclick).filter(':first').click(); | |
function onclick(tabs){ | |
var tag = $(this).text(); | |
$('li.selected', obj).removeClass(); | |
$(this).parent().addClass('selected'); | |
get_image(tag); | |
}; | |
function show_image(data){ | |
var list = '<ul class="gallerylist">'; | |
$.each(data.items, function(i,item){ | |
var title = (item.title) ? item.title : "none"; | |
var url = item.url; | |
var img = item.thumbnail; | |
list += '<li><div class="image"><a href="'+url+'" class="highslide" onclick="return hs.expand(this)"><img src="'; | |
list += img+'" alt="Highslide JS" title="Click to enlarge" height="100px" /></a></div>'; | |
list += '<div class="highslide-caption"><p>'; | |
list += title+'</p><ul class="exif">'; | |
$.each(item.exifinfo, function(key,value){ | |
list+='<li>'+key+':'+ value+'</li>'; | |
}); | |
list+= '</ul></div></li>'; | |
}); | |
list+= '</ul>'; | |
tabContent.empty().append(list); | |
$('ul.gallerylist',tabContent).innerfade({ | |
speed: options.speed, | |
timeout: options.timeout, | |
type: options.type | |
}); | |
}; | |
function get_image(tag){ | |
var url = options.baseurl+tag+'.json'; | |
$.getJSON(url, function(data){show_image(data);}); | |
return false; | |
}; | |
}); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment