- This topic has 8 replies, 3 voices, and was last updated 4 months, 1 week ago by
David.
-
AuthorPosts
-
October 8, 2020 at 2:39 am #1478076
nik9
Hello
Is there a way to replace (only on mobile) the text „add to cart“ from the add to cart banner from a single product page which is shown after a user scrolls down with a icon?
On mobile, this text takes to much space and the customer dont see the full productname. So this is why we had the idea to replace this text with a icon but ONLY on mobile. Tablet and desktop have enought space to display the content.
Cheers
October 8, 2020 at 3:45 am #1478165David
StaffCustomer SupportHi there,
you could do something like this:
@media(max-width: 769px) { .woocommerce .inside-add-to-cart-panel button.button.alt { font-size: 0; } .woocommerce .inside-add-to-cart-panel button.button.alt:before { content: url('url_to_icon_image'); font-size: 16px; } }
Simply update the
url_to_icon_image
– note the image cannot be styled eg. resized when using thecontent
property – so the original image needs to be the exact size you require.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 8, 2020 at 3:48 am #1478169nik9
Hi david,
Can we use icons from font awesome? This icons should have the right size.
Content: '\f217';
Does not work.Cheers
October 8, 2020 at 4:09 am #1478190nik9
Update:
I was able to fix it. I have also to use the css propertie:
font-family: "Font Awesome 5 Free";
Thanks 🙂
October 8, 2020 at 4:32 am #1478236David
StaffCustomer SupportGlad to hear you got that resolved 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 23, 2020 at 12:16 pm #1501681nik9
Hello David,
We just noticed that on some devices the icon is not shown. https://ibb.co/y0mdJQt
Do I forget something here?
@media(max-width: 769px) { .woocommerce .inside-add-to-cart-panel button.button.alt { font-size: 0; } } .woocommerce .inside-add-to-cart-panel button.button.alt:before { content: '\f217'; font-family: "Font Awesome 5 Free"; font-size: 16px; } }
October 23, 2020 at 5:06 pm #1501863Leo
StaffCustomer SupportTough to tell without seeing the site in question but looks like you might have some extra brackets in your CSS?
Try comparing your CSS with David CSS here:
https://generatepress.com/forums/topic/replace-add-to-cart-text-on-mobile-with-icon/#post-1478165Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 25, 2020 at 7:07 am #1503285nik9
Hello Leo,
The difference is taht we use a font awesome icon instead of a url
content: url('url_to_icon_image');
.Or what do you mean? 🙂
Cheers
October 25, 2020 at 8:57 am #1503619David
StaffCustomer SupportTry increasing the media query size from 769px to 828px ( or greater ) some of the newer iphones have a higher resolution.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.