Try pasting an image inside a div using the function

I want to make a gallery view using the jqtouch js library, so I try to insert an image using a function that does not show anything, but when I do not use the function, it works correctly, document.getElementById ("#") is also used. innerHTML it working, when I just insert an image, it shows that plz help

    <script>

    function fun(){
            $("#thumbs_container").append('<ul id="thumbs"      class="thumbView" style="display:none;"><li class="pic"><a   href="#photo_container"><img                               src="thumbs/1.jpg" alt="images/1.jpg" title="this is a description"/></a></li></ul>');
    }
    </script>

    <body  onLoad="fun();">
    <div id="about" class="selectable">
        <p><img src="codropsIcon.png"/></p>
        <p>
            <strong>Wonderwall Image Gallery</strong>
            <a href="http://www.codrops.com">By Codrops</a>
        </p>
        <p>A web app created with <br /> <strong>jQTouch</strong></p>
        <p><br /><br /><a href="#" class="grayButton goback">Close</a></p>
    </div>
    <!-- The list of images (thumbs) -->
    <div id="thumbs_container" class="current">
        <div class="toolbar">
            <h1>Thumbs</h1>
            <a class="button slideup" id="infoButton" href="#about">About</a>
        </div>


        <!--<ul id="thumbs" class="thumbView" style="display:none;">
            <li class="pic"><a href="#photo_container"><img        src="thumbs/1.jpg" alt="images/1.jpg" title="this is a description"/></a></li>
            <li class="pic"><a href="#photo_container"><img src="thumbs/2.jpg" alt="images/2.jpg" title="great!"/></a></li>

        </ul>-->




    </div>
    <!-- The single image container -->
    <div id="photo_container">
        <div class="toolbar">
            <h1>Photo</h1>
            <a class="back" href="#thumbs_container">Photos</a>
            <a class="button slideup" id="infoButton" href="#about">About</a>
        </div>
        <div class="loader" style="display:none;"></div>
        <div id="theimage" class="singleimage"></div>
        <div class="descriptionWrapper">
            <p id="description"></p>
            <div id="prev" style="display:none;"></div>
            <div id="next" style="display:none;"></div>
        </div>  
      </div>
    </body>
  </html>
+4
source share
2 answers

You have it style="display:none;installed in your function. Remove this and it should work fine.

0
source

1) jQuery . , , , - , jQuery:

<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>

2) HTML, , :

style="display:none;"

, , .

3) , , , , .

0

Source: https://habr.com/ru/post/1543777/


All Articles