مشکل اصلی کدی که ارسال کردهاید این است که تگهای <style> و <script> داخل تگهای <p> قرار گرفتهاند. این قرارگیری باعث میشود که مرورگر کدهای جاوااسکریپت و CSS را به درستی تفسیر نکند و از اجرای آنها جلوگیری کند. برای رفع این مشکل، نیاز است که این تگها را از داخل تگهای <p> خارج کنید و در ساختار مناسبی قرار دهید. همچنین، بهتر است تمام کدها را در یک ساختار کامل HTML قرار دهید تا به درستی اجرا شوند.
در زیر کد کامل و اصلاح شده را مشاهده میکنید:
<!DOCTYPE html>
<html lang="fa">
<head>
<meta charset="UTF-8">
<title>ربات تحلیل تصاویر هوشمند</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;700&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Vazirmatn', sans-serif;
}
body {
background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
padding: 2rem 1rem;
}
.unique-start-button-container {
width: 100%;
max-width: 600px;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 2rem;
perspective: 1000px;
}
.unique-start-button {
background: radial-gradient(circle at 50% 50%, #f77062, #fe5196);
color: white;
border-radius: 25px;
padding: 20px 70px;
font-size: 1.3rem;
font-weight: bold;
border: none;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
gap: 12px;
position: relative;
overflow: hidden;
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
box-shadow: 0 10px 30px rgba(254, 81, 150, 0.3),
inset 0 -3px 0 rgba(0, 0, 0, 0.1);
transform-style: preserve-3d;
}
.unique-start-button::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
transparent,
rgba(255, 255, 255, 0.4),
transparent
);
animation: shimmer 3s infinite;
}
.unique-start-button:hover {
transform: translateY(-5px) rotateX(10deg);
box-shadow: 0 20px 40px rgba(254, 81, 150, 0.4),
inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}
.unique-start-button:active {
transform: translateY(2px);
box-shadow: 0 5px 15px rgba(254, 81, 150, 0.4);
}
.start-icon {
width: 28px;
height: 28px;
position: relative;
animation: rotateIcon 3s linear infinite;
}
.start-icon svg {
width: 100%;
height: 100%;
fill: white;
}
.analysis-buttons {
width: 100%;
display: none;
flex-direction: column;
gap: 1.5rem;
opacity: 0;
transform: translateY(20px) scale(0.95);
}
.analysis-buttons.visible {
display: flex;
animation: buttonsAppear 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.analysis-button {
width: 100%;
padding: 18px 40px;
border-radius: 15px;
border: none;
font-size: 1.1rem;
font-weight: 500;
color: white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
gap: 12px;
position: relative;
overflow: hidden;
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
transform-style: preserve-3d;
--x: 0;
--y: 0;
}
.analysis-button:first-child {
background: linear-gradient(135deg, #43cea2, #185a9d);
box-shadow: 0 8px 20px rgba(67, 206, 162, 0.3),
inset 0 -2px 0 rgba(0, 0, 0, 0.1);
}
.analysis-button:last-child {
background: linear-gradient(135deg, #834d9b, #d04ed6);
box-shadow: 0 8px 20px rgba(131, 77, 155, 0.3),
inset 0 -2px 0 rgba(0, 0, 0, 0.1);
}
.analysis-button::before {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(
90deg,
transparent,
rgba(255, 255, 255, 0.2),
transparent
);
transform: translateX(-100%);
transition: transform 0.6s ease;
}
.analysis-button:hover {
transform: translateY(-3px) scale(1.02);
filter: brightness(1.1);
}
.analysis-button:hover::before {
transform: translateX(100%);
}
.analysis-button:active {
transform: translateY(2px) scale(0.98);
}
/* Ripple Effect Styles */
.analysis-button::after {
content: '';
position: absolute;
width: 100px;
height: 100px;
background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
transform: translate(-50%, -50%);
left: var(--x);
top: var(--y);
opacity: 0;
transition: opacity 0.3s;
pointer-events: none;
}
.analysis-button:hover::after {
opacity: 0.3;
}
.hero-section {
text-align: center;
margin-bottom: 3rem;
padding: 2.5rem;
background: rgba(255, 255, 255, 0.95);
border-radius: 20px;
box-shadow: 0 15px 35px rgba(31, 38, 135, 0.15);
max-width: 800px;
width: 100%;
transform: translateY(-20px);
opacity: 0;
animation: heroAppear 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
backdrop-filter: blur(10px);
}
.hero-title {
color: transparent;
font-size: 2.5rem;
margin-bottom: 1.5rem;
background: linear-gradient(45deg, #3490dc, #6574cd);
-webkit-background-clip: text;
background-clip: text;
position: relative;
display: inline-block;
}
.hero-title::after {
content: '';
position: absolute;
bottom: -5px;
left: 0;
width: 100%;
height: 3px;
background: linear-gradient(45deg, #3490dc, #6574cd);
transform: scaleX(0);
transform-origin: right;
animation: titleUnderline 1s ease-out 0.5s forwards;
}
.hero-section p {
color: #4a5568;
font-size: 1.1rem;
opacity: 0;
animation: fadeIn 0.8s ease-out 1s forwards;
}
.faq-container {
max-width: 800px;
width: 100%;
background: white;
border-radius: 20px;
box-shadow: 0 15px 35px rgba(31, 38, 135, 0.15);
overflow: hidden;
margin-bottom: 2rem;
opacity: 0;
transform: translateY(20px);
animation: faqAppear 1s cubic-bezier(0.4, 0, 0.2, 1) 0.5s forwards;
}
.faq-item {
border-bottom: 1px solid #e2e8f0;
}
.faq-item:last-child {
border-bottom: none;
}
.faq-question {
padding: 1.5rem;
width: 100%;
text-align: right;
background: none;
border: none;
font-size: 1.1rem;
font-weight: 500;
color: #2d3748;
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
transition: all 0.3s ease;
}
.faq-question:hover {
background: #f7fafc;
color: #3182ce;
padding-right: 2rem;
}
.faq-question.active {
background: #f0f4f8;
color: #3182ce;
}
.icon {
transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
font-size: 1.2rem;
}
.faq-question.active .icon {
transform: rotate(180deg);
}
.faq-answer {
max-height: 0;
overflow: hidden;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
background: #f8fafc;
padding: 0 1.5rem;
opacity: 0;
}
.faq-answer.active {
max-height: 300px;
padding: 1.5rem;
opacity: 1;
}
.faq-answer p {
color: #4a5568;
line-height: 1.6;
}
.video-container {
width: 100%;
max-width: 600px;
margin: 0 auto;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}
.video-container video {
width: 100%;
height: auto;
display: block;
}
@keyframes rotateIcon {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
@keyframes shimmer {
100% { transform: translateX(100%); }
}
@keyframes buttonsAppear {
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
@keyframes heroAppear {
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes titleUnderline {
to {
transform: scaleX(1);
}
}
@keyframes fadeIn {
to {
opacity: 1;
}
}
@keyframes faqAppear {
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes ripple {
from {
transform: translate(-50%, -50%) scale(0);
opacity: 1;
}
to {
transform: translate(-50%, -50%) scale(4);
opacity: 0;
}
}
@media (max-width: 768px) {
.hero-title {
font-size: 2rem;
}
.unique-start-button {
padding: 15px 40px;
font-size: 1.1rem;
}
.analysis-button {
padding: 15px 30px;
font-size: 1rem;
}
.hero-section {
padding: 1.5rem;
}
.faq-question {
font-size: 1rem;
padding: 1.2rem;
}
.faq-answer.active {
padding: 1.2rem;
}
}
</style>
</head>
<body>
<!-- دکمه شروع در بالای صفحه -->
<div class="unique-start-button-container">
<button id="startButton" class="unique-start-button">
شروع
<span class="start-icon">
<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg">
<path d="M32 2C17.664 2 6 13.664 6 28c0 14.336 11.664 26 26 26s26-11.664 26-26C58 13.664 46.336 2 32 2zm0 48c-11.046 0-20-8.954-20-20S20.954 10 32 10s20 8.954 20 20-8.954 20-20 20z"></path>
<path d="M32 16a16 16 0 100 32 16 16 0 000-32z"></path>
<path d="M32 24a8 8 0 100 16 8 8 0 000-16z"></path>
</svg>
</span>
</button>
<div id="analysisButtons" class="analysis-buttons">
<button class="analysis-button">تحلیل ابتدایی تصاویر</button>
<button class="analysis-button">تحلیل پیشرفته تصاویر</button>
</div>
</div>
<!-- بخش هیرو -->
<div class="hero-section">
<h1 class="hero-title">ربات تحلیل تصاویر هوشمند</h1>
<p>با استفاده از تکنولوژی پیشرفته هوش مصنوعی</p>
</div>
<!-- بخش سوالات -->
<div class="faq-container" id="faq-container">
<div class="faq-item">
<button class="faq-question">
<span>🤖 این ربات چه کاری انجام میدهد؟</span>
<span class="icon">▼</span>
</button>
<div class="faq-answer">
<p>این ربات با استفاده از تکنولوژی پیشرفته هوش مصنوعی، قابلیت تحلیل تصاویر را دارد. شما میتوانید تصویر مورد نظر خود را آپلود کرده و از ربات بخواهید توضیحات مربوط به آن را ارائه دهد. همچنین میتوانید اسکرینشاتهای خود را به کد تبدیل کنید و از خلاقیتهای بیپایان این ربات بهرهمند شوید.</p>
</div>
</div>
<div class="faq-item">
<button class="faq-question">
<span>🎥 آموزش استفاده از ربات</span>
<span class="icon">▼</span>
</button>
<div class="faq-answer">
<div class="video-container">
<video width="300" height="150" controls="controls" controlslist="nodownload">
<source src="https://uploadkon.ir/uploads/695002_24Screenrecorder-2024-11-02-16-25-31-317.mp4" type="video/mp4" />
مرورگر شما از پخش ویدیو پشتیبانی نمیکند.
</video>
</div>
</div>
</div>
<div class="faq-item">
<button class="faq-question">
<span>📝 آیا ربات از زبان فارسی پشتیبانی میکند؟</span>
<span class="icon">▼</span>
</button>
<div class="faq-answer">
<p>بله، هر دو ربات تحلیل تصاویر از متن فارسی پشتیبانی میکنند. در صورتی که ربات توضیحات را به انگلیسی ارائه دهد، کافیست از آن بخواهید متن را به فارسی ترجمه کند.</p>
</div>
</div>
</div>
<!-- اسکریپتها -->
<script>
// تابع برای اضافه کردن انیمیشنهای پیشرفته به دکمهها
function addButtonAnimations() {
const buttons = document.querySelectorAll('.analysis-button');
buttons.forEach(button => {
// ایجاد افکت موج هنگام کلیک
button.addEventListener('click', function(e) {
let ripple = document.createElement('span');
ripple.style.position = 'absolute';
ripple.style.background = 'rgba(255, 255, 255, 0.7)';
ripple.style.transform = 'translate(-50%, -50%)';
ripple.style.pointerEvents = 'none';
ripple.style.borderRadius = '50%';
ripple.style.animationName = 'ripple';
ripple.style.animationDuration = '1s';
const rect = this.getBoundingClientRect();
const size = Math.max(rect.width, rect.height);
ripple.style.width = ripple.style.height = size + 'px';
ripple.style.left = (e.clientX - rect.left) + 'px';
ripple.style.top = (e.clientY - rect.top) + 'px';
this.appendChild(ripple);
setTimeout(() => ripple.remove(), 1000);
});
// افکت hover پیشرفته
button.addEventListener('mousemove', function(e) {
const rect = this.getBoundingClientRect();
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;
this.style.setProperty('--x', `${x}px`);
this.style.setProperty('--y', `${y}px`);
});
});
}
// تابع برای اضافه کردن انیمیشن به FAQ
function initFAQ() {
const faqQuestions = document.querySelectorAll('.faq-question');
faqQuestions.forEach(question => {
question.addEventListener('click', () => {
const answer = question.nextElementSibling;
const isActive = question.classList.contains('active');
// بستن همه سوالات فعال
faqQuestions.forEach(q => {
q.classList.remove('active');
q.nextElementSibling.classList.remove('active');
});
// باز کردن سوال کلیک شده
if (!isActive) {
question.classList.add('active');
answer.classList.add('active');
// اضافه کردن انیمیشن اسکرول
answer.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}
});
});
}
// تابع برای انیمیشن دکمه شروع
function initStartButton() {
const startButton = document.getElementById('startButton');
const analysisButtons = document.getElementById('analysisButtons');
startButton.addEventListener('click', () => {
// انیمیشن محو شدن دکمه شروع
startButton.style.transform = 'scale(0.8)';
startButton.style.opacity = '0';
setTimeout(() => {
startButton.style.display = 'none';
// نمایش دکمههای تحلیل با انیمیشن
analysisButtons.classList.add('visible');
}, 300);
});
// اضافه کردن افکت hover سهبعدی
startButton.addEventListener('mousemove', function(e) {
const rect = this.getBoundingClientRect();
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;
const centerX = rect.width / 2;
const centerY = rect.height / 2;
const angleX = (y - centerY) / 20;
const angleY = (centerX - x) / 20;
this.style.transform = `perspective(1000px) rotateX(${angleX}deg) rotateY(${angleY}deg) scale(1.05)`;
});
startButton.addEventListener('mouseleave', function() {
this.style.transform = 'perspective(1000px) rotateX(0) rotateY(0) scale(1)';
});
}
// اضافه کردن انیمیشن به اسکرول صفحه
function addScrollAnimations() {
const sections = document.querySelectorAll('.hero-section, .faq-container');
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
}
});
}, {
threshold: 0.1
});
sections.forEach(section => observer.observe(section));
}
// راهاندازی همه توابع هنگام لود صفحه
document.addEventListener('DOMContentLoaded', () => {
initStartButton();
addButtonAnimations();
initFAQ();
addScrollAnimations();
// اضافه کردن انیمیشنهای اضافی به المانهای صفحه
document.querySelectorAll('.hero-title').forEach(title => {
title.style.opacity = '0';
title.style.transform = 'translateY(-20px)';
setTimeout(() => {
title.style.opacity = '1';
title.style.transform = 'translateY(0)';
}, 300);
});
});
</script>
</body>
</html>
تغییرات اعمال شده:
-
حذف تگهای <p> اطراف تگهای <style> و <script>:
- تگهای
<style> و <script> نباید داخل تگهای <p> قرار بگیرند. آنها باید به صورت مستقیم داخل <head> یا <body> باشند.
-
استفاده از ساختار کامل HTML:
- اضافه کردن تگهای
<!DOCTYPE html>, <html>, <head>, و <body> برای داشتن یک ساختار صحیح HTML.
-
ادغام تمامی استایلها:
- تمامی استایلها در یک تگ
<style> قرار گرفتهاند تا از تضاد و مشکلات احتمالی جلوگیری شود.
-
انتقال اسکریپتها به انتهای <body>:
- این کار تضمین میکند که تمامی المانهای DOM قبل از اجرای جاوااسکریپت بارگذاری شدهاند.
-
رفع مشکلات احتمالی جاوااسکریپت:
- با قرار دادن اسکریپتها در جای مناسب و اطمینان از عدم وجود خطاهای نحوی، عملکرد کد جاوااسکریپت بهبود یافته است.
این اصلاحات باید مشکل عدم نمایش دکمههای تحلیل پس از کلیک کردن روی دکمه شروع را برطرف کند. لطفاً این کد را در محیط خود تست کنید و مطمئن شوید که همه مسیرهای فایلها (مانند ویدیوی آپلود شده) به درستی کار میکنند. اگر همچنان مشکلی دارید، لطفاً خطاهای کنسول مرورگر خود را بررسی کرده و اطلاعات بیشتری ارائه دهید تا بتوانم بهتر کمک کنم.