Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
It all depends on how you currently have it implemented.
1. If the data set remains the same (images, headings, description), then with the help of js the style is simply changed, for example, the number of goods per line. You can also move the markup with the help of js, but it’s better to prescribe css wisely and change classes when changing the view mode.
2. If the product data itself is initially obtained by ajax and lies somewhere in json, then depending on the active button, you can fill in different markup templates with js. For example, there are two markup templates on the page, one of them is display: none, the second one is filled with data. When you click on the button, swap - fill the first block with data, the second in display: none.
3. If, however, when changing the mode, the number and type of data can change, then only receive data with ajax and then follow paragraph 2 or receive ready-made partial markup and insert it into the desired block. If the front lives separately, then everything is the same as in paragraph 2.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question