用jQuery编写LI

用jQuery编写LI,jquery,html,Jquery,Html,我正在定制一个现有的jQuery幻灯片,我想知道是否有人可以帮助更改将Flickr源图像写入LI的背景图像CSS类的基本系统,而不是将其作为LI中的内联图像写入 目前的代码是: $.each(r.query.results.photo,function(){ data = this; // Creating a new LI element with the photo as its // centered background image: $('<li&

我正在定制一个现有的jQuery幻灯片,我想知道是否有人可以帮助更改将Flickr源图像写入LI的背景图像CSS类的基本系统,而不是将其作为LI中的内联图像写入

目前的代码是:

$.each(r.query.results.photo,function(){
    data = this;
    // Creating a new LI element with the photo as its
    // centered background image:
    $('<li>', {
        css : {
            backgroundImage: 'url('+templateReplace(flickrSRC,data)+')',
            width: options.width
        }
    }).appendTo(ul);
});
$.each(r.query.results.photo,function()){
数据=这个;
//以照片为基础创建新的LI元素
//居中背景图像:
$(“
  • ”{ css:{ 背景图片:'url('+templateReplace(flickrSRC,data)+'), 宽度:options.width } }).附录(ul); });
  • 因此,不必将图像写入背景图像CSS类,是否可以将图像src写入LI中包含的项目中-因此它变成:

    <li><img src="url('+templateReplace(flickrSRC,data)+')'" /></li>
    

  • 我正在努力想办法

    您不需要更改此滑块,您可以使用下面链接的插件。此滑块可滑动每个html元素。 以下是下载链接:

    )()

    试试这个

    $.each(r.query.results.photo,function(){
        data = this;
        // Creating a new LI element with the photo as its
        // centered background image:
        $('<li>').html($("<img>").attr("src", templateReplace(flickrSRC, data))).appendTo(ul);
    });
    
    $.each(r.query.results.photo,function()){
    数据=这个;
    //以照片为基础创建新的LI元素
    //居中背景图像:
    
    $(“
  • ”).html($”($)谢谢,nivoslider很不错。但是我很高兴使用我已经有的那一个//谢谢