[英]Jquery image path not changing
I have a jquery ajax carousel and I am trying to edit the path, but what ever I do with it, it's not changing up. 我有一个jquery ajax轮播,我正在尝试编辑路径,但是无论我做什么,它都没有改变。 Can any one please help me out with this.
谁能帮我这个忙。
Here is the jquery code 这是jQuery代码
$(document).ready(function () {
var dir = "../images/big-carousel/";
var first = true;
var className = 'class="item active"';
var fileextension = ".jpg";
$.ajax({
url: dir,
success: function (data) {
$(data).find("a:contains(" + fileextension + ")").each(function () {
if (first == false) {
className = 'class="item"';
}
var filename = this.href.replace(window.location.host, "").replace("http:///tabs/", "");
$("#bigCarousel .carousel-inner").append($("<div " + className + " style=\"background-image:url(" + filename + dir + ")\"></div>"));
first = true;
});
}
HTML Code HTML代码
<div id="background-carousel">
<div id="bigCarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner" >
</div>
</div>
</div>
请尝试以下代码:
$("#bigCarousel .carousel-inner").append($("<div " + className + " style=\"background-image:url(" + dir + filename + ")\"></div>"));
try to replace you last line jquery code with following :- 尝试将您的最后一行jquery代码替换为以下内容:-
$("#bigCarousel .carousel-inner").append($("<div " + className + " style=\"background-image:url('" + filename + dir + "')\"></div>"));
It may help you. 它可能会帮助您。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.