Support Forum › Support Forum › GDPR Cookie Compliance › Customize the floating button “Change the cookies settings”
- AuthorPosts
- December 21, 2022 @ 11:13 pm
Hi guys!
Congrats for your work!
A quick question. How can i customize the floating button of “Change the cookies settings” on my website with CSS? It appears on bottom-left position by default on mobile.
Many thanks and all the best!
George
Moove Agency
January 13, 2023 @ 10:45 amHi George,
You can use this snippet in functions.php to determine the position of the floating button:
add_action('moove_gdpr_inline_styles','gdpr_cookie_css_extension_floating_button_position',10,3); function gdpr_cookie_css_extension_floating_button_position( $styles, $primary, $secondary ) { /** * You can align the button position by using the variables below (values are in pixels) */ $bottom_mobile = 20; $left_mobile = 20; $bottom_desktop = 20; $left_desktop = 20; $styles.= '#moove_gdpr_save_popup_settings_button:not(.gdpr-floating-button-custom-position) { bottom: '. $bottom_desktop. 'px; left: '. $left_desktop. 'px }'; $styles.= '@media (max-width: 767px) { #moove_gdpr_save_popup_settings_button:not(.gdpr-floating-button-custom-position) { bottom: '. $bottom_mobile. 'px; left: '. $left_mobile. 'px } }'; return $styles; }
Hope this helps.
January 16, 2023 @ 7:19 pmHi again!
I have tried changing all the “left” values by “right” on my functions.php with this snippet, but its not working.
Could you please help me?
Thansks!
Jorge
————–
This is the snippet i have added to my functions.php:
add_action(‘moove_gdpr_inline_styles’,’gdpr_cookie_css_extension_floating_button_position’,10,3); function gdpr_cookie_css_extension_floating_button_position( $styles, $primary, $secondary ) {
/** * You can align the button position by using the variables below (values are in pixels) */
$bottom_mobile = 20; $right_mobile = 20;
$bottom_desktop = 20; $right_desktop = 20;$styles.= ‘#moove_gdpr_save_popup_settings_button:not(.gdpr-floating-button-custom-position) { bottom: ‘. $bottom_desktop. ‘px; right: ‘. $right_desktop. ‘px }’; $styles.= ‘@media (max-width: 767px) { #moove_gdpr_save_popup_settings_button:not(.gdpr-floating-button-custom-position) { bottom: ‘. $bottom_mobile. ‘px; right: ‘. $right_mobile. ‘px } }’;
return $styles; }
Moove Agency
February 01, 2023 @ 1:35 pmHi Jorge
You can try this:
add_action('moove_gdpr_inline_styles','gdpr_cookie_css_extension_floating_button_position',10,3); function gdpr_cookie_css_extension_floating_button_position( $styles, $primary, $secondary ) { /** * You can align the button position by using the variables below (values are in pixels) */ $bottom_mobile = '20px'; $left_mobile = 'auto'; $right_mobile = '20px'; $bottom_desktop = '20px'; $left_desktop = 'auto'; $right_desktop = '20px'; $styles.= '#moove_gdpr_save_popup_settings_button:not(.gdpr-floating-button-custom-position) { bottom: '. $bottom_desktop. '; left: '. $left_desktop. '; right: '. $right_desktop. '}'; $styles.= '@media (max-width: 767px) { #moove_gdpr_save_popup_settings_button:not(.gdpr-floating-button-custom-position) { bottom: '. $bottom_mobile. '; left: '. $left_mobile. '; right: '. $right_mobile. ' } }'; return $styles; }
If it still doesn’t work for you, we recommend not using the snippet and contact an experienced web developer who can assist you.
Hope this helps.
- AuthorPosts
The topic ‘Customize the floating button “Change the cookies settings”’ is closed to new replies.