Submitted 3 months agoA solution to the E-commerce product page challenge
Ecommerce Product Page using dialogs
pure-css
P
@Joshk7

Solution retrospective
What are you most proud of, and what would you do differently next time?
I liked the use of dialog elements in html.
What challenges did you encounter, and how did you overcome them?I major issue that I encountered was centering the checkout dialog relative to the shopping cart button that I used as a trigger to open a dialog.
const handleCartButton = (e) => { if (large.matches) { const rect = cartButton.getBoundingClientRect(); checkoutDialog.style.position = "absolute"; checkoutDialog.style.top = `${rect.bottom + window.scrollY}px`; checkoutDialog.style.left = `${ rect.left + rect.width / 2 + window.scrollX }px`; checkoutDialog.style.transform = "translateX(-50%)"; } if (checkoutDialog.open) { checkoutDialog.close(); } else { checkoutDialog.show(); } };
I used javascript to adjust the position of the dialog accordingly, however, there might be better ways to achieve this.
What specific areas of your project would you like help with?Specifically, I'd like any suggestions or help on how to make that checkout dialog better. Generally, any tips on how to create modals would be helpful as well.
Code
Loading...
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Josh Kahlbaugh's solution.
Join 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