Design comparison
Solution retrospective
I have some issues with the masonry script. I do not want to use the grid-template-rows: masonry, because the support of this in the browsers is still at the low level. So I used the macy.js script. It works fine, but I could not figured out where should I insert the masonry snippet, because the elements of the grid was inserted with template literals from js file and it caused the problem with the order of scripts and stylesheets. First, I wanted to split it into the two files, but later I put the snippet after the loop of template literals and it works.
I used the "JS-heavy" approach. I fetch the data of all paintings from the JSON files and then I use one html file called "detail.html" where the data are displayed with the template literal which is set in the "detail.js".
I stored the data of all paintings in the sessionStorage, so I cannot fetch the data with every reload.
It would be great if you leave me a comment about my work.
Happy coding! 👋👩🦰
Community feedback
- @ghintemaPosted about 2 years ago
Hi Tereza,
I've had a look at your solution to the galleria slideshow. I am really impressed!! :) I am trying to build it for myself. I am not sure, how to realize the slider. Should I make a real slider with Javascript? Or in this case bunch of different pages linked to each other??
I'd like to ask you something and woud like to learn something from you. It's about this query-like url with 'painting=0' at the end. When you zapp your slides, it just increases this 'painting-parameter'. I don't know that technice and would like to learn more about it. As far as I understand it, you have only ONE page (html-file) for all the different slides and depending on this 'painting= ? ' parameter do you choose, what is beeing shown. Right? Can you give me a short explanation of how it works? Do you have a key-word for me to google this technice? Do you need a framework to do this trick?
I highly thank you for your help!! :) Harm
0@sirriahPosted about 2 years ago@ghintema Hi, I replied to you on the slack, please continue with the conversation there.
I will post my answer for somebody, who may be interested.
Yes, I have only one page, which listens the parameter from URL. If you open my code for detail.html, you can see that before </body>, there is a script link for detail.js - this script can read the parameter and displays the right image with this index.
First I created the homepage. I took that JSON file, where you can find all info about images. https://github.com/sirriah/FM-galleria-slideshow-site/blob/main/data.json This is in the starter pack folder from frontend mentor. This I can load with JS and the whole gallery on the homepage is an output of the forEach cycle which took element from JSON one by one and fill the template literal with the data of this element. https://github.com/sirriah/FM-galleria-slideshow-site/blob/main/js/home.js There you can see, that there is defined the url with parameter. I store the JSON data in the sessionStorage, because it is faster to read the data from the sessionStorage.
In the detail.js, I read the parameter from the URL and pick the right element from the sessionStorage. There is another template literal which outputs the main content for detail.html.
This is simplified approach how the modern pages can be build. Because for example e-shop with thousands of products you cannot build a single html page for every product, it is nonsense. What if you want to make a change in the footer? You will have to open thousands of pages… I think you understand.
I don’t know how much you understand the JS, but try to purchase some complex course. I took this https://www.discount-courses.com/courses/javascript-es6 but maybe you can find some free courses on the youtube. That one above is little bit boring, but you can find there almost everything. Happy coding.
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord