How can I make an adaptable list of images in Javascript?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















Currently, I am working on a Javascript, HTML, CSS and Google maps project.
For now, I only have the map and a button which opens a box with a list of images.



.report-img {
margin: 20px;
outline: none;
z-index: 5;
position: absolute;
}

.report-box {
padding: 10px;
border: 2px solid black;
background-color: white;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 5;
box-sizing: border-box;
}

ul {
margin: 10px;
padding: 0;
overflow: hidden;
display: block;
}

li {
display: block;
float: left;
margin-top: 5px;
margin-left: 15px;
margin-right: 15px;
margin-bottom: 5px;
}

.listImage {
outline: none;
width: 100%;
height: auto;
}

.listText {
font-size: 12px;
text-align: center;
word-wrap: break-word;
width: 60px;
}


This is my list.



<img
id="report-img"
class="report-img"
src="pictures/64/sea.png"
onclick="openReportBox()"
/>
<div id="report-box" class="report-box" style="display: none">
<ul id="variableTable" style="display: block">
<li>
<img
id="dirtywater"
class="listImage"
src="pictures/64/dirtywater.png"
width="64"
height="64"
/>
<p class="listText">Agua sucia</p>
</li>
<li>
<img
id="group"
class="listImage"
src="pictures/64/group.png"
width="64"
height="64"
/>
<p class="listText">Gente</p>
</li>
<li>
<img
id="jellyfish"
class="listImage"
src="pictures/64/jellyfish.png"
/>
<p class="listText">Agua-vivas</p>
</li>
<li>
<img
id="waves"
class="listImage"
src="pictures/64/waves.png"
width="64"
height="64"
/>
<p class="listText">Olas</p>
</li>
<li>
<img
id="wind"
class="listImage"
src="pictures/64/windy.png"
width="64"
height="64"
/>
<p class="listText">viento</p>
</li>
</ul>


I want to make this scale to the size of the screen but whatever I try is useless. I always end up with something like this which is not what I want.



https://imgur.com/a/UwCgRgc



I ve seen a lot of tutorials and a lot of stackoverflow posts but I could not manage myself to achieve what I want. Any suggestion?










share|improve this question




















  • 1





    I have no idea what that image is showcasing. Can you please post a minimal example so we can help you, this isn't a lot of information to go off of.

    – zfrisch
    Nov 23 '18 at 20:37











  • @zfrisch Thanks for response. You can enter the link I posted and make zoom to see each image

    – Mauricio Estevez
    Nov 23 '18 at 21:51











  • I appreciate that you're new, so no offense at all, but you're not going to get help that way. You need to post all your relevant information inside of your question.

    – zfrisch
    Nov 23 '18 at 21:58











  • Thanks once again. I edit the post and give more info.

    – Mauricio Estevez
    Nov 24 '18 at 1:54


















0















Currently, I am working on a Javascript, HTML, CSS and Google maps project.
For now, I only have the map and a button which opens a box with a list of images.



.report-img {
margin: 20px;
outline: none;
z-index: 5;
position: absolute;
}

.report-box {
padding: 10px;
border: 2px solid black;
background-color: white;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 5;
box-sizing: border-box;
}

ul {
margin: 10px;
padding: 0;
overflow: hidden;
display: block;
}

li {
display: block;
float: left;
margin-top: 5px;
margin-left: 15px;
margin-right: 15px;
margin-bottom: 5px;
}

.listImage {
outline: none;
width: 100%;
height: auto;
}

.listText {
font-size: 12px;
text-align: center;
word-wrap: break-word;
width: 60px;
}


This is my list.



<img
id="report-img"
class="report-img"
src="pictures/64/sea.png"
onclick="openReportBox()"
/>
<div id="report-box" class="report-box" style="display: none">
<ul id="variableTable" style="display: block">
<li>
<img
id="dirtywater"
class="listImage"
src="pictures/64/dirtywater.png"
width="64"
height="64"
/>
<p class="listText">Agua sucia</p>
</li>
<li>
<img
id="group"
class="listImage"
src="pictures/64/group.png"
width="64"
height="64"
/>
<p class="listText">Gente</p>
</li>
<li>
<img
id="jellyfish"
class="listImage"
src="pictures/64/jellyfish.png"
/>
<p class="listText">Agua-vivas</p>
</li>
<li>
<img
id="waves"
class="listImage"
src="pictures/64/waves.png"
width="64"
height="64"
/>
<p class="listText">Olas</p>
</li>
<li>
<img
id="wind"
class="listImage"
src="pictures/64/windy.png"
width="64"
height="64"
/>
<p class="listText">viento</p>
</li>
</ul>


I want to make this scale to the size of the screen but whatever I try is useless. I always end up with something like this which is not what I want.



https://imgur.com/a/UwCgRgc



I ve seen a lot of tutorials and a lot of stackoverflow posts but I could not manage myself to achieve what I want. Any suggestion?










share|improve this question




















  • 1





    I have no idea what that image is showcasing. Can you please post a minimal example so we can help you, this isn't a lot of information to go off of.

    – zfrisch
    Nov 23 '18 at 20:37











  • @zfrisch Thanks for response. You can enter the link I posted and make zoom to see each image

    – Mauricio Estevez
    Nov 23 '18 at 21:51











  • I appreciate that you're new, so no offense at all, but you're not going to get help that way. You need to post all your relevant information inside of your question.

    – zfrisch
    Nov 23 '18 at 21:58











  • Thanks once again. I edit the post and give more info.

    – Mauricio Estevez
    Nov 24 '18 at 1:54














0












0








0








Currently, I am working on a Javascript, HTML, CSS and Google maps project.
For now, I only have the map and a button which opens a box with a list of images.



.report-img {
margin: 20px;
outline: none;
z-index: 5;
position: absolute;
}

.report-box {
padding: 10px;
border: 2px solid black;
background-color: white;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 5;
box-sizing: border-box;
}

ul {
margin: 10px;
padding: 0;
overflow: hidden;
display: block;
}

li {
display: block;
float: left;
margin-top: 5px;
margin-left: 15px;
margin-right: 15px;
margin-bottom: 5px;
}

.listImage {
outline: none;
width: 100%;
height: auto;
}

.listText {
font-size: 12px;
text-align: center;
word-wrap: break-word;
width: 60px;
}


This is my list.



<img
id="report-img"
class="report-img"
src="pictures/64/sea.png"
onclick="openReportBox()"
/>
<div id="report-box" class="report-box" style="display: none">
<ul id="variableTable" style="display: block">
<li>
<img
id="dirtywater"
class="listImage"
src="pictures/64/dirtywater.png"
width="64"
height="64"
/>
<p class="listText">Agua sucia</p>
</li>
<li>
<img
id="group"
class="listImage"
src="pictures/64/group.png"
width="64"
height="64"
/>
<p class="listText">Gente</p>
</li>
<li>
<img
id="jellyfish"
class="listImage"
src="pictures/64/jellyfish.png"
/>
<p class="listText">Agua-vivas</p>
</li>
<li>
<img
id="waves"
class="listImage"
src="pictures/64/waves.png"
width="64"
height="64"
/>
<p class="listText">Olas</p>
</li>
<li>
<img
id="wind"
class="listImage"
src="pictures/64/windy.png"
width="64"
height="64"
/>
<p class="listText">viento</p>
</li>
</ul>


I want to make this scale to the size of the screen but whatever I try is useless. I always end up with something like this which is not what I want.



https://imgur.com/a/UwCgRgc



I ve seen a lot of tutorials and a lot of stackoverflow posts but I could not manage myself to achieve what I want. Any suggestion?










share|improve this question
















Currently, I am working on a Javascript, HTML, CSS and Google maps project.
For now, I only have the map and a button which opens a box with a list of images.



.report-img {
margin: 20px;
outline: none;
z-index: 5;
position: absolute;
}

.report-box {
padding: 10px;
border: 2px solid black;
background-color: white;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 5;
box-sizing: border-box;
}

ul {
margin: 10px;
padding: 0;
overflow: hidden;
display: block;
}

li {
display: block;
float: left;
margin-top: 5px;
margin-left: 15px;
margin-right: 15px;
margin-bottom: 5px;
}

.listImage {
outline: none;
width: 100%;
height: auto;
}

.listText {
font-size: 12px;
text-align: center;
word-wrap: break-word;
width: 60px;
}


This is my list.



<img
id="report-img"
class="report-img"
src="pictures/64/sea.png"
onclick="openReportBox()"
/>
<div id="report-box" class="report-box" style="display: none">
<ul id="variableTable" style="display: block">
<li>
<img
id="dirtywater"
class="listImage"
src="pictures/64/dirtywater.png"
width="64"
height="64"
/>
<p class="listText">Agua sucia</p>
</li>
<li>
<img
id="group"
class="listImage"
src="pictures/64/group.png"
width="64"
height="64"
/>
<p class="listText">Gente</p>
</li>
<li>
<img
id="jellyfish"
class="listImage"
src="pictures/64/jellyfish.png"
/>
<p class="listText">Agua-vivas</p>
</li>
<li>
<img
id="waves"
class="listImage"
src="pictures/64/waves.png"
width="64"
height="64"
/>
<p class="listText">Olas</p>
</li>
<li>
<img
id="wind"
class="listImage"
src="pictures/64/windy.png"
width="64"
height="64"
/>
<p class="listText">viento</p>
</li>
</ul>


I want to make this scale to the size of the screen but whatever I try is useless. I always end up with something like this which is not what I want.



https://imgur.com/a/UwCgRgc



I ve seen a lot of tutorials and a lot of stackoverflow posts but I could not manage myself to achieve what I want. Any suggestion?







javascript






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 1:57







Mauricio Estevez

















asked Nov 23 '18 at 20:35









Mauricio EstevezMauricio Estevez

8719




8719








  • 1





    I have no idea what that image is showcasing. Can you please post a minimal example so we can help you, this isn't a lot of information to go off of.

    – zfrisch
    Nov 23 '18 at 20:37











  • @zfrisch Thanks for response. You can enter the link I posted and make zoom to see each image

    – Mauricio Estevez
    Nov 23 '18 at 21:51











  • I appreciate that you're new, so no offense at all, but you're not going to get help that way. You need to post all your relevant information inside of your question.

    – zfrisch
    Nov 23 '18 at 21:58











  • Thanks once again. I edit the post and give more info.

    – Mauricio Estevez
    Nov 24 '18 at 1:54














  • 1





    I have no idea what that image is showcasing. Can you please post a minimal example so we can help you, this isn't a lot of information to go off of.

    – zfrisch
    Nov 23 '18 at 20:37











  • @zfrisch Thanks for response. You can enter the link I posted and make zoom to see each image

    – Mauricio Estevez
    Nov 23 '18 at 21:51











  • I appreciate that you're new, so no offense at all, but you're not going to get help that way. You need to post all your relevant information inside of your question.

    – zfrisch
    Nov 23 '18 at 21:58











  • Thanks once again. I edit the post and give more info.

    – Mauricio Estevez
    Nov 24 '18 at 1:54








1




1





I have no idea what that image is showcasing. Can you please post a minimal example so we can help you, this isn't a lot of information to go off of.

– zfrisch
Nov 23 '18 at 20:37





I have no idea what that image is showcasing. Can you please post a minimal example so we can help you, this isn't a lot of information to go off of.

– zfrisch
Nov 23 '18 at 20:37













@zfrisch Thanks for response. You can enter the link I posted and make zoom to see each image

– Mauricio Estevez
Nov 23 '18 at 21:51





@zfrisch Thanks for response. You can enter the link I posted and make zoom to see each image

– Mauricio Estevez
Nov 23 '18 at 21:51













I appreciate that you're new, so no offense at all, but you're not going to get help that way. You need to post all your relevant information inside of your question.

– zfrisch
Nov 23 '18 at 21:58





I appreciate that you're new, so no offense at all, but you're not going to get help that way. You need to post all your relevant information inside of your question.

– zfrisch
Nov 23 '18 at 21:58













Thanks once again. I edit the post and give more info.

– Mauricio Estevez
Nov 24 '18 at 1:54





Thanks once again. I edit the post and give more info.

– Mauricio Estevez
Nov 24 '18 at 1:54












1 Answer
1






active

oldest

votes


















0














Use onclick event document.getElementById("your_id").style.backgroundSize="cover"orset width=100% height=100% position:centerif you want onClick event else simply right background-size="cover" in the css of your element if you want it by default.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53452680%2fhow-can-i-make-an-adaptable-list-of-images-in-javascript%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Use onclick event document.getElementById("your_id").style.backgroundSize="cover"orset width=100% height=100% position:centerif you want onClick event else simply right background-size="cover" in the css of your element if you want it by default.






    share|improve this answer




























      0














      Use onclick event document.getElementById("your_id").style.backgroundSize="cover"orset width=100% height=100% position:centerif you want onClick event else simply right background-size="cover" in the css of your element if you want it by default.






      share|improve this answer


























        0












        0








        0







        Use onclick event document.getElementById("your_id").style.backgroundSize="cover"orset width=100% height=100% position:centerif you want onClick event else simply right background-size="cover" in the css of your element if you want it by default.






        share|improve this answer













        Use onclick event document.getElementById("your_id").style.backgroundSize="cover"orset width=100% height=100% position:centerif you want onClick event else simply right background-size="cover" in the css of your element if you want it by default.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 23 '18 at 20:39









        Himanshu AhujaHimanshu Ahuja

        1,0392219




        1,0392219
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53452680%2fhow-can-i-make-an-adaptable-list-of-images-in-javascript%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            If I really need a card on my start hand, how many mulligans make sense? [duplicate]

            Alcedinidae

            Can an atomic nucleus contain both particles and antiparticles? [duplicate]