I have a grid view (using flex box approach) and i want to change it to list view using style sheet and j query/java script.
Problem: Since in grid view approach all elements are in separate div, while changing it to list view they all need to be in single line (some still need vertically aligned) and this is responsive application.
I have created style sheet class to change flex box from row to column and things look good. But now all div are not in single line. Need some help with style sheet class.
On click of a button, i will remove grid-row, grid-item and add grid-column and grid-column-item classes. But as shown in HTML, it is all div structure in grid-item class. I need to change this div as well (like product_search_img class on extreme left in
a single line followed by next three div in one column (in same line) and then followed by price, add to cart button in one column.
I have to switch between grid and list view on clicking of a button on client side using jquery, that is why I am looking for css solution, so that i can add/remove css classes using jquery to achieve required result.
According to your description, I'm sorry that I'm not so clear about your requirement.
The class you provided is not included in your sample code like grid-column class.
Harry US11
On click of a button, i will remove grid-row, grid-item and add grid-column and grid-column-item classes. But as shown in HTML, it is all div structure in grid-item class. I need to change this div as well (like product_search_img class on extreme left in a
single line followed by next three div in one column (in same line) and then followed by price, add to cart button in one column.
Could you provide the related code so that it will be easier to know about your issue?
For my understanding, do you mean that you want to change the layout horizontally to vertically?
If you want to place the div vertically, I suggest that you could use boortstrap list-group.
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
219 Points
201 Posts
Convert div structure into single line for list view
Jul 01, 2019 05:44 PM|Harry US11|LINK
I have a grid view (using flex box approach) and i want to change it to list view using style sheet and j query/java script.
Problem: Since in grid view approach all elements are in separate div, while changing it to list view they all need to be in single line (some still need vertically aligned) and this is responsive application.
I have created style sheet class to change flex box from row to column and things look good. But now all div are not in single line. Need some help with style sheet class.
On click of a button, i will remove grid-row, grid-item and add grid-column and grid-column-item classes. But as shown in HTML, it is all div structure in grid-item class. I need to change this div as well (like product_search_img class on extreme left in a single line followed by next three div in one column (in same line) and then followed by price, add to cart button in one column.
I have to switch between grid and list view on clicking of a button on client side using jquery, that is why I am looking for css solution, so that i can add/remove css classes using jquery to achieve required result.
Contributor
2100 Points
705 Posts
Re: Convert div structure into single line for list view
Jul 03, 2019 08:45 AM|Jenifer Jiang|LINK
Hi Harry US11,
According to your description, I'm sorry that I'm not so clear about your requirement.
The class you provided is not included in your sample code like grid-column class.
Could you provide the related code so that it will be easier to know about your issue?
For my understanding, do you mean that you want to change the layout horizontally to vertically?
If you want to place the div vertically, I suggest that you could use boortstrap list-group.
For more, you could refer to : https://getbootstrap.com/docs/4.0/components/list-group/#custom-content
Best Regards,
Jenifer
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
219 Points
201 Posts
Re: Convert div structure into single line for list view
Jul 03, 2019 04:02 PM|Harry US11|LINK
Hi Jennifer,
The screenshots that i have provided here : https://stackoverflow.com/questions/56813267/convert-div-structure-into-single-line-for-list-view
may help you better understand the problem.
Contributor
2100 Points
705 Posts
Re: Convert div structure into single line for list view
Jul 04, 2019 09:40 AM|Jenifer Jiang|LINK
Hi Harry US11,
According to the image, I seem to understand your requirment.
I've made a test and find that maybe the grid-column class is not so good.
I suggest that you could just use jquery to remove the class grid-row and add the bootstrap's class list-group.
And remove grid-item, then add grid-column-item, the layout will be shown as list view.
$(function () { $("#test").click(function () { $(this).siblings().removeClass('grid-row').end().toggleClass('list-group'); }) }) <input id="test" type="button" value="testbtn" />
Best Regards,
Jenifer
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.