多个模式代码未显示任何模式

时间:2018-08-10 14:48:13

标签: javascript html bootstrap-modal

我已经在这个问题上停留了一段时间,因为我对使用html中的脚本了解不多。我正在尝试获取4张图像,以便在单击它们时以模态形式更大地显示它们的图像,但是它似乎不起作用? w3-hover-opacity似乎也无法正常工作,我不确定是否与该问题有关?

我以此为参考: https://www.w3schools.com/w3css/w3css_modal.asp

谢谢

<div id="section3" class="container-fluid">
    <h2> 3D Models and Animation</h2>
    <p1>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature
 from 45 BC, making it over 2000 years old. Richard McClintock, a Latin
 professor at Hampden-Sydney College in Virginia, looked up one of the
 more obscure Latin words, consectetur, from a Lorem Ipsum passage, and
 going through the cites of the word in classical literature,
 discovered the undoubtable source. Lorem Ipsum comes from sections
 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise
 on the theory of ethics, very popular during the Renaissance. The
 first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from
 a line in section 1.10.32</p1>
    <div class="row">

        <div class="col-sm-3 modelimages">
            <img  src="3D/deformation.jpg" style="cursor:pointer" alt="deformation animation" class="img-responsive center-block
 w3-hover-opacity">
        </div>

        <div class="col-sm-3 modelimages"> 
            <img src="3D/car.jpg" alt="car"  class="img-responsive center-block" onclick="onClick(this)">
        </div>

        <div class="col-sm-3 modelimages">
            <img src="3D/deformation.jpg" alt="deformation animation"  class="img-responsive center-block">
        </div>

        <div class="col-sm-3 modelimages">
            <img src="3D/deformation.jpg" alt="deformation animation"  class="img-responsive center-block">
        </div>

        <div id="modal01" class="w3-modal" onclick="this.style.display='none'">
             <span class="w3-button
 w3-hover-red w3-xlarge w3-display-topright">&times;</span>   
             <div class="w3-modal-content w3-animate-zoom">
                <img id="img01" style="width:100%">   
             </div> 
         </div>

<script> 
    function onClick(element) {               
        document.getElementById("img01").src = element.src;  
      document.getElementById("modal01").style.display = "block"; 
    }
</script>

    </div>

</div>

0 个答案:

没有答案