嗨,我不想从 xml 加载图片,而是通过 prettyphoto 加载它,这是我的 xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<images>
<image source="Zdjecia/Galeria/Kategoria1/Miniaturki/image1.jpg"
lightbox="Zdjecia/Galeria/Kategoria1/Duze/image1.jpg"/>
<image source="Zdjecia/Galeria/Kategoria1/Miniaturki/image2.jpg"
lightbox="Zdjecia/Galeria/Kategoria1/Duze/image2.jpg"/>
<image source="Zdjecia/Galeria/Kategoria1/Miniaturki/image3.jpg"
lightbox="Zdjecia/Galeria/Kategoria1/Duze/image3.jpg"/>
<image source="Zdjecia/Galeria/Kategoria1/Miniaturki/image4.jpg"
lightbox="Zdjecia/Galeria/Kategoria1/Duze/image4.jpg"/>
<image source="Zdjecia/Galeria/Kategoria1/Miniaturki/image5.jpg"
lightbox="Zdjecia/Galeria/Kategoria1/Duze/image5.jpg"/>
<image source="Zdjecia/Galeria/Kategoria1/Miniaturki/image6.jpg"
lightbox="Zdjecia/Galeria/Kategoria1/Duze/image6.jpg"/>
<image source="Zdjecia/Galeria/Kategoria1/Miniaturki/image7.jpg"
lightbox="Zdjecia/Galeria/Kategoria1/Duze/image7.jpg"/>
<image source="Zdjecia/Galeria/Kategoria1/Miniaturki/image8.jpg"
lightbox="Zdjecia/Galeria/Kategoria1/Duze/image8.jpg"/>
<image source="Zdjecia/Galeria/Kategoria1/Miniaturki/image9.jpg"
lightbox="Zdjecia/Galeria/Kategoria1/Duze/image9.jpg"/>
<image source="Zdjecia/Galeria/Kategoria1/Miniaturki/image10.jpg"
lightbox="Zdjecia/Galeria/Kategoria1/Duze/image10.jpg"/>
</images>
这是我的js函数:
jQuery(window).ready(function($) {
$.get("XML/Kategoria1.xml",{},function(xml){
$('image',xml).each(function(i) {
lightbox = $(this).find("lightbox").text();
});
});
$.fn.prettyPhoto();
});
function openLightbox(path) {
$.prettyPhoto.open(lightbox);
}
我要打开的第一个图像是“路径”,它是从 Flash 发送的,下一个我想从名为“lightbox”的 xml 加载的图像,但是这个脚本不起作用,任何人都可以告诉我为什么或解释我该怎么做?请寻求帮助。
这是我的 html 文件:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pl" xml:lang="pl">
<head>
<title>portfolio</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/prettyPhoto.css" media="all"/>
<script type="text/javascript" src="scripts/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="scripts/jquery.prettyPhoto.js"></script>
<script type="text/javascript" src="scripts/swfobject.js"></script>
<script type="text/javascript" src="scripts/swffit.js"></script>
<script type="text/javascript">
swfobject.embedSWF("portfolio.swf", "my_flash", "980", "640", "9.0.0", "", false, {wmode:'transparent'});
swffit.fit("my_flash");
$(document).ready(function($) {
$.get("xml/kategoria1.xml",{},function(xml){
$('image',xml).each(function(i) {
lightbox = $(this).find("lightbox").text();
openLightbox(lightbox);
});
});
function openLightbox(path) {
$.prettyPhoto.open(path);
}
</script>
<style type="text/css" media="screen">
html, body { height:100%; background-color: #000000;}
body { margin:0; padding:0; overflow:hidden; }
#flashContent { width:100%; height:100%; }
</style>
</head>
<body>
<div id="my_flash">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100%" height="100%" id="portfolio" align="middle">
<param name="movie" value="portfolio.swf" />
<param name="quality" value="best" />
<param name="bgcolor" value="#000000" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="transparent" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="lt" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="portfolio.swf" width="100%" height="100%">
<param name="movie" value="portfolio.swf" />
<param name="quality" value="best" />
<param name="bgcolor" value="#000000" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="transparent" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="lt" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflash">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Pobierz odtwarzacz Adobe Flash Player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</body>
</html>
我尝试做一些事情,这个脚本从 xml 加载单个图像,任何想法如何从 xml 加载所有“灯箱”图像?
jQuery(window).ready(function($) {
$.fn.prettyPhoto();
$.get("xml/kategoria1.xml",{},function(xml){
$('image',xml).each(function(i) {
lightbox = $(this).find("lightbox").text();
openLightbox(lightbox)
});
});
});
function openLightbox(path) {
$.prettyPhoto.open(path);