Response title
This is preview!
<?xml version="1.0" encoding="utf-8"?>
<myimages>
<myimage title="Picture 1" imageurl="/img/flowing-rock.jpg" className="">
<description>
info about picture 1
</description>
</myimage>
<myimage title="Picture 2" imageurl="/img/stones.jpg" className="">
<description>
info about picture 2
</description>
</myimage>
<myimage title="Why the long face?" imageurl="/img/ladybug.jpg" className="">
<description>
info about picture 3
</description>
</myimage>
<myimage title="Lightning" imageurl="/img/lightning.jpg" className="active">
<description>
info about picture 4
</description>
</myimage>
<myimage title="Lotus" imageurl="/img/lotus.jpg" className="">
<description>
info about picture 4
</description>
</myimage>
<myimage title="Mojave" imageurl="/img/mojave.jpg" className="">
<description>
info about picture 4
</description>
</myimage>
<myimage title="Pier" imageurl="/img/pier.jpg" className="">
<description>
info about picture 4
</description>
</myimage>
<myimage title="Sea Mist" imageurl="/img/sea-mist.jpg" className="">
<description>
info about picture 4
</description>
</myimage>
</myimages>
$(document).ready(function(){
var html = "";
$.get('images.xml', function(d){
$(d).find('myimage').each(function(){
var $myimage = $(this);
var title = $myimage.attr("title");
var description = $myimage.find('description').text();
var className = $myimage.attr('className');
if(!className) className = '';
var imageurl = $myimage.attr('imageurl');
html = '<li> <img class="'+ className + '" alt="' + description + '" src="' + imageurl + '" title=\"' + title + '\"/> </li>\n';
document.getElementById('img_replace').innerHTML += html;
});
});
<h1>Galleria Demo 01</h1>
<div class="demo">
<div id="main_image"></div>
<ul class="gallery_demo_unstyled">
<div id="img_replace" class="gallery_demo_unstyled gallery_demo galleria"></div>
<!-- <li><img src="img/flowing-rock.jpg" alt="Flowing Rock" title="Flowing Rock Caption"></li>
<li><img src="img/stones.jpg" alt="Stones" title="Stones - from Apple images"></li>
<li class="active"><img src="img/grass-blades.jpg" alt="Grass Blades" title="Apple nature desktop images"></li>
<li><img src="img/ladybug.jpg" alt="Ladybug" title="Ut rutrum, lectus eu pulvinar elementum, lacus urna vestibulum ipsum"></li>
<li><img src="img/lightning.jpg" alt="Lightning" title="Black & White"></li>
<li><img src="img/lotus.jpg" alt="Lotus" title="Fusce quam mi, sagittis nec, adipiscing at, sodales quis"></li>
<li><img src="img/mojave.jpg" alt="Mojave" title="Suspendisse volutpat posuere dui. Suspendisse sit amet lorem et risus faucibus pellentesque."></li>
<li><img src="img/pier.jpg" alt="Pier" title="Proin erat nisi"></li>
<li><img src="img/sea-mist.jpg" alt="Sea Mist" title="Caption text from title"></li> -->
</ul>
<p class="nav"><a href="#" onclick="$.galleria.prev(); return false;">« previous</a> | <a href="#" onclick="$.galleria.next(); return false;">next »</a></p>
</div>
$.ajax({
type: "GET",
url: "photo.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('photo').each(function(){
var id = $(this).attr('id')
var url = $(this).find('url').text()
var title = $(this).find('title').text()
var desc = $(this).find('desc').text()
$('<li></li>')
.html('<img src="'+ url +'" alt="'+ desc +'" title="'+ title +'">')
.appendTo('#box');
});
}
});
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<galry>
<photo id='1' added="2003-06-10">
<url>http://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Gandhi_Sept1944.jpg/180px-Gandhi_Sept1944.jpg</url>
<title>Mohandas Karamchand Gandhi</title>
<desc>bla bla 1</desc>
</photo>
<photo id='2' added="2003-06-31">
<url>http://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Brucedickinson.jpg/180px-Brucedickinson.jpg</url>
<title>Bruce Dickinson</title>
<desc>Astraeus</desc>
</photo>
<photo id='3' added="2003-06-25">
<url>http://upload.wikimedia.org/wikipedia/commons/thumb/8/80/Fgugea318.jpg/180px-Fgugea318.jpg</url>
<title>Airbus A318</title>
<desc>bla bla 2</desc>
</photo>
</galry>
<ul class="gallery_demo_unstyled" id="box"></ul>
<ul class="gallery_demo_unstyled" id="box"></ul>
<ul class="gallery_demo_unstyled"></ul>
<li><img src="img/flowing-rock.jpg" alt="Flowing Rock" title="Flowing Rock Caption"></li>
<li><img src="img/stones.jpg" alt="Stones" title="Stones - from Apple images"></li>
</ul>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Galleria Demo 1</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="imagetoolbar" content="false">
<meta name="description" content="">
<meta name="keywords" content="">
<link href="http://devkick.com/lab/galleria/galleria.css" rel="stylesheet" type="text/css" media="screen">
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.js"></script>
<script type="text/javascript" src="http://devkick.com/lab/galleria/jquery.galleria.pack.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$.ajax({
type: "GET",
url: "photo.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('photo').each(function(){
var id = $(this).attr('id')
var url = $(this).find('url').text()
var title = $(this).find('title').text()
var desc = $(this).find('desc').text()
$('<li></li>')
.html('<img src="'+ url +'" alt="'+ desc +'" title="'+ title +'">')
.appendTo('#box');
});
}
});
$('.gallery_demo_unstyled').addClass('gallery_demo'); // adds new class name to maintain degradability
$('ul.gallery_demo').galleria({
history : true, // activates the history object for bookmarking, back-button etc.
clickNext : true, // helper for making the image clickable
insert : '#main_image', // the containing selector for our main image
onImage : function(image,caption,thumb) { // let's add some image effects for demonstration purposes
// fade in the image & caption
image.css('display','none').fadeIn(1000);
caption.css('display','none').fadeIn(1000);
// fetch the thumbnail container
var _li = thumb.parents('li');
// fade out inactive thumbnail
_li.siblings().children('img.selected').fadeTo(500,0.3);
// fade in active thumbnail
thumb.fadeTo('fast',1).addClass('selected');
// add a title for the clickable image
image.attr('title','Next image >>');
},
onThumb : function(thumb) { // thumbnail effects goes here
// fetch the thumbnail container
var _li = thumb.parents('li');
// if thumbnail is active, fade all the way.
var _fadeTo = _li.is('.active') ? '1' : '0.3';
// fade in the thumbnail when finnished loading
thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
// hover effects
thumb.hover(
function() { thumb.fadeTo('fast',1); },
function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active
)
}
});
});
</script>
<style media="screen,projection" type="text/css">
/* BEGIN DEMO STYLE */
*{margin:0;padding:0}
body{padding:20px;background:white;text-align:center;background:black;color:#bba;font:80%/140% georgia,serif;}
h1,h2{font:bold 80% 'helvetica neue',sans-serif;letter-spacing:3px;text-transform:uppercase;}
a{color:#348;text-decoration:none;outline:none;}
a:hover{color:#67a;}
.caption{font-style:italic;color:#887;}
.demo{position:relative;margin-top:2em;}
.gallery_demo{width:702px;margin:0 auto;}
.gallery_demo li{width:68px;height:50px;border:3px double #111;margin: 0 2px;background:#000;}
.gallery_demo li div{left:240px}
.gallery_demo li div .caption{font:italic 0.7em/1.4 georgia,serif;}
#main_image{margin:0 auto 60px auto;height:438px;width:700px;background:black;}
#main_image img{margin-bottom:10px;}
.nav{padding-top:15px;clear:both;font:80% 'helvetica neue',sans-serif;letter-spacing:3px;text-transform:uppercase;}
.info{text-align:left;width:700px;margin:30px auto;border-top:1px dotted #221;padding-top:30px;}
.info p{margin-top:1.6em;}
</style>
</head>
<body>
<h1>Galleria Demo 01</h1>
<div class="demo">
<div id="main_image"></div>
<ul class="gallery_demo_unstyled" id="box"></ul>
<p class="nav"><a href="#" onclick="$.galleria.prev(); return false;">« previous</a> | <a href="#" onclick="$.galleria.next(); return false;">next »</a></p>
</div>
<div class="info">
<h2>Information</h2>
<p>This demonstration shows you aome more advanced effects you can accomplish with the Galleria plugin. The history object is also active, so feel free to try the back button in your browser and bookmark a page. The next and previous links are simple to create since the galleria object has two public functions for traversing the images in your list.</p>
<p>This gallery was created from a simple unordered list with images - thumbnails and functionality is all in the Galleria plugin. Viewing this page without javascript or CSS enabled with degrade it into a list of full-size images.</p>
<p>Visit the galleria project: <a href="http://galleria.googlecode.com">http://galleria.googlecode.com</a></p>
<p class="footer"><a href="http://monc.se/galleria">Galleria home page</a> | <a href="http://monc.se">Made by monc</a></p>
</body>
</html>
© 2013 jQuery Foundation
Sponsored by and others.