Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.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 点击显示图像_Javascript_Html_Css - Fatal编程技术网

Javascript 点击显示图像

Javascript 点击显示图像,javascript,html,css,Javascript,Html,Css,您可以使用简单的javascript实现这一点,使用两个具有不同内容的div并隐藏一个div 在HTML中 @keyframes fillup { from {width:0%} to {width:75%} } @media(max-width:992px){ .comment-contain,.auth{padding-top:50px !important} .auth-name{font-size:16px !important} } @media(

您可以使用简单的javascript实现这一点,使用两个具有不同内容的div并隐藏一个div

在HTML中

@keyframes fillup {
    from {width:0%}
    to {width:75%}
}



@media(max-width:992px){
    .comment-contain,.auth{padding-top:50px !important}
    .auth-name{font-size:16px !important}
}
@media(min-width:993px){    
    .comment-contain,.auth{padding-top:50px !important}
}








#content{color:#90a4ae;position: absolute;top:130px;right: 0;left: 0;}
.post{margin-bottom:20px}
/*  post image*/

.post>div.post-image{background:#4fc3f7;border-radius:50%;z-index:2;position:relative;width:100%;background-position:center !important;
-webkit-box-shadow: 0px 0px 14px 2px rgba(33,33,33,1);
-moz-box-shadow: 0px 0px 14px 2px rgba(33,33,33,1);
box-shadow: 0px 0px 14px 2px rgba(33,33,33,1);
transition:1s all ease;-webkit-transition:1s all ease;-moz-transition:1s all ease;-ms-transition:1s all ease;
}
.post>div.post-image:hover{background-size:150% 150% !important;cursor: pointer;}

.postdate{font-size:20px;color:#fff;font-weight:700;background:rgba(21,21,21,0.5);border-radius:50%;opacity:0;text-align:center;
transition:0.3s all ease;-webkit-transition:0.3s all ease;-moz-transition:0.3s all ease;-ms-transition:0.3s all ease;}
.postdate>span{font-size:30px;font-weight:300}
.post>div.post-image:hover .postdate{opacity:1}
/* votes*/
.vote{font-size:20px;color: #e0e0e0;}

#up-vote,#down-vote{font-size:20px;color:#e0e0e0;line-height:35px;font-weight:300;margin-top:10px;
transition:0.3s all ease-in;-webkit-transition:0.3s all ease-in;-moz-transition:0.3s all ease-in;-ms-transition:0.3s all ease-in;}

#up-vote{margin-left:20px}
#down-vote{text-align:right;margin-right:20px}
.up-vote,.down-vote{font-size:20px;color:#e0e0e0}

/* below*/
.post-below{border:2px solid #e0e0e0;color:#e0e0e0;border-radius:5px;z-index:1;position:relative;}
/*post date & time*/

.post-head{font-size:25px;font-weight:500;}
.post-head-bottom{float:left;animation:fillup 2s;-webkit-animation: fillup 2s;-moz-animation: fillup 2s;width:75%;height:2px;background:#fff}
.post-detail{height:50px;}

.comment-contain,.auth{padding-top:20px}
.comment{border:2px solid #ffd54f ;padding:10px;font-weight:500;color:#e0e0e0;background:rgba(255,213,79,0.5);}

.auth-img{width:40px;height:40px;border-radius:50%}
.auth-name{color:#e0e0e0;font-size:18px;font-weight:300;line-height:40px}
在jquery中

#container {
  width:100%;
  height: 100px;
  background-color: green;
  text-align: center;
}

#red {
  width:100%;
  height: 100%;
  background-color: red;
}

#blue{
  width:100%;
  height: 100%;
  background-color: blue;
  display: none;
}

这里有一个

让你的问题的标题简单明了,当我点击左边的一颗星星时,它会在游戏标题下显示两个圆圈,在这些圆圈中有评级。同样,当我点击右边的图标时,它会显示与图片中相同的信息。你在文档中的哪里包含了
jQuery.js
?我想为这些功能编写代码,然后我想在我的文档中实现它们。我通过保留属性引用在3个html页面中实现了这一点,但我希望整个过程都在单个html页面中完成。您是否尝试过指向每个项目id的javascript onclick事件?tanx,但我需要一个图标作为链接。当我将鼠标放在该图标上时,它应该悬停而不是移动更改内容您可以使用带有图标的“a”标记实现我的示例,而不必是“button”元素,
<div id="container">
  <button id="btnChange">Change Content</button>
  <div id="red">
    This is red content
  </div>
  <div id="blue">
    This is blue content
  </div>
#container {
  width:100%;
  height: 100px;
  background-color: green;
  text-align: center;
}

#red {
  width:100%;
  height: 100%;
  background-color: red;
}

#blue{
  width:100%;
  height: 100%;
  background-color: blue;
  display: none;
}
  $(document).ready(function () {
                var content = "red";
        $("#btnChange").click(
            function () {
                if(content == "red"){
                  $("#red").hide();
                  $("#blue").show();
                  content = "blue";
                }else if (content == "blue"){
                    $("#blue").hide();
                  $("#red").show();
                  content = "red";
                }
            }            
        );
    });