Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/411.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Jquery更改图像-图像相互覆盖_Javascript_Jquery - Fatal编程技术网

Javascript 使用Jquery更改图像-图像相互覆盖

Javascript 使用Jquery更改图像-图像相互覆盖,javascript,jquery,Javascript,Jquery,我有以下Jquery switch (catSelected) { case (""): if (city == 1) { cityName = "ROME"; $("#banner_img").css("background-image", "url(/images/HomePageBanner/rome_home1.jpg)"); $("#homePageGallery1 img").attr("

我有以下Jquery

switch (catSelected) {
    case (""):
        if (city == 1) {
            cityName = "ROME";
            $("#banner_img").css("background-image", "url(/images/HomePageBanner/rome_home1.jpg)");
            $("#homePageGallery1 img").attr("src", "/images/TourListBanner/VatBannernew.png");
            $("#homePageGallery1").find("a").attr("href", "/official-vatican-museum-partnership");
            $("#homePageGallery1 img").show();
            break;
        }
        else if(city == 0) {
            cityName = "VATICAN";
            $("#banner_img").css("background-image", "url(/images/TourListBanner/vatican1.jpg)");
            $("#homePageGallery1 img").attr("src", "/images/TourListBanner/VatBannernew.png");
            $("#homePageGallery1").find("a").attr("href", "/official-vatican-museum-partnership");
            break;
        }
当您更改类别时,它会更改顶部横幅图片。问题是已经有一张图片了,我不知道如何去掉它或在上面显示新图片

更改类别后的顶部横幅:

<img id="banner_img" class="resrc" style="height: auto; max-width: 1600px; width: 100%; background-image: url(http://localhost:45000/images/TourListBanner/colosseum-ancient-rome1.jpg);" data-src="http://app.resrc.it/o=85/http://www.x.com/images/listings/rome.jpg" alt="" data-resrc-width="1600" src="http://app.resrc.it/s=w1600,pd1/o=85/http://www.x.com/images/listings/rome.jpg">


我想我需要使用google jquery更改图像属性,我知道了,$(this.attr(“src”,src);删除当前的内容,将图像置于图像之上

你能稍微展开一点吗,你的问题不是很清楚,可能需要添加一些内容