-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanimation.php
More file actions
39 lines (34 loc) · 1.15 KB
/
Copy pathanimation.php
File metadata and controls
39 lines (34 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* CTA button pulsing animation.
* The button will pulse, changing size and opacity, with a pause between pulses.
*/
function sticky_phone_button_animation_css()
{
$options = sticky_phone_button_get_settings();
$blink_time_ms = isset($options['sticky_phone_button_blink_time']) ? $options['sticky_phone_button_blink_time'] : '4000';
// Convert from milliseconds to seconds for CSS
$blink_time_sec = $blink_time_ms / 1000;
?> <style>
@keyframes pulse {
0%, 100% {
transform: scale(1);
opacity: 1;
}
10% {
transform: scale(1.05);
opacity: 1;
}
20% {
transform: scale(1);
opacity: 1;
}
/* From 20% to 100% the button remains unchanged - pause between pulses */
}
/* New class for animation activation - will not be applied automatically */
.animate-pulse {
animation: pulse <?php echo esc_attr($blink_time_sec); ?>s infinite;
}
</style> <?php
}
add_action('wp_head', 'sticky_phone_button_animation_css');