Místo pro zvědavé medvědy

Search

Button origin

Výsledný vzhled tlačítka s otočením

ID tlačítka:

„origin-button“

Element HTML v Elementor PRO

Pro vložení kódu použijeme v Elementoru jednoduše element „HTML“.

Není to ovšem podmínkou, s kódem je možné pracovat i v běžném prostředí WordPressu.

-info- Jako u všech kódů na stránkách www.bearhugs.space máte u většiny funkcí popisky s funkcemi, ty je dobré následně vymazat.

Vzhled zápisu HTML

				
					<div class="button-container">
    
    <button id="origin-button" class="button" data-link="https://www.VÁŠ ODKAZ.com">
        Klikněte zde
    </button>
</div>

<div id="particle-container"></div> <script type="litespeed/javascript">function generateParticles(event){const button=event.target;const particleContainer=document.getElementById('particle-container');const rect=button.getBoundingClientRect();const centerX=rect.left+rect.width/2;const centerY=rect.top+rect.height/2;const particleCount=40;for(let i=0;i<particleCount;i++){const particle=document.createElement('div');particle.className='particle';particle.style.left=`${centerX}px`;particle.style.top=`${centerY}px`;const angle=Math.random()*2*Math.PI;const velocity=Math.random()*150+50;const deltaX=Math.cos(angle)*velocity;const deltaY=Math.sin(angle)*velocity;particle.style.transform=`translate(${deltaX}px, ${deltaY}px) scale(0)`;particleContainer.appendChild(particle);setTimeout(()=>{particle.remove()},1000)}}
document.getElementById('origin-button').addEventListener('click',function(event){generateParticles(event);const link=event.target.getAttribute('data-link');if(link){window.open(link,'_blank')}})</script> 
				
			

Vzhled zápisu CSS

				
					/* Kontejner tlačítka */
.button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 300px;
    position: relative;
}

/* Styl tlačítka */
.button {
    position: relative;
    width: 200px;
    height: 60px;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    line-height: 60px;
    color: #fff;
    background: linear-gradient(45deg, #FF6F61, #FFD700);
    border: none;
    border-radius: 30px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    box-shadow: 0 8px 15px rgba(255, 111, 97, 0.5);
}

/* Efekt při najetí myší */
.button:hover {
    transform: rotate(360deg) scale(1.1);
    box-shadow: 0 12px 25px rgba(255, 215, 0, 0.6);
}

/* Animovaný pozadí */
.button:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4), transparent);
    transform: scale(0.5);
    transition: transform 0.7s ease;
    z-index: -1;
}

.button:hover:before {
    transform: scale(1);
}

/* Kontejner pro částice */
#particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Styl částic */
.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8), transparent);
    border-radius: 50%;
    pointer-events: none;
    animation: particle-explosion 1s ease-out forwards;
}

/* Animace částic */
@keyframes particle-explosion {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--deltaX), var(--deltaY)) scale(0);
        opacity: 0;
    }
}

				
			

Tlačítka jsou velmi významným prvkem webových stránek.

Mají i velmi důležitý význam pro marketingovou strategii, především mají plnit svou základní povinnost, tedy vyzívat k akci. Vychází to i z původního anglického názvu: CTA – call to Action.

Pevně věřím, že Vám některá z tlačítek z našich ukázek pomohou vylepšit Vaši webovou prezentaci.

Ať se Vám daří při tvorbě webu!