@Artem26rus7

Как сделать, чтобы скрипт работал для определенного ID в html?

5bbce228c738d876488052.png5bbce43d6bf66878220176.png
<div class="container">
			<div class="row">
				<div class="col-md-4">
					<div id="text_box" onmouseover="changeItem()" onmouseout="rechangeItem()">
						<div id="mouse"></div>
						<h2>Бесплатная доставка</h2>
						<p>Заполнив заявку на нашем сайте, мы доставим мишку за 2 часа. Так же мы осуществляем доставку по всей России, от 3 до 5 дней</p>
					</div>
					<div class="sub-line">
						<div id="circle"></div>
						<div id="line"></div>
					</div>
					<div id="text_box2" onmouseover="changeItem()" onmouseout="rechangeItem()">
						<div id="mouse2"></div>
						<h2>Бесплатная доставка</h2>
						<p>Заполнив заявку на нашем сайте, мы доставим мишку за 2 часа. Так же мы осуществляем доставку по всей России, от 3 до 5 дней</p>
					</div>
					<div class="sub-line">
						<div id="circle2"></div>
						<div id="line2"></div>
					</div>
				</div>
				<div class="col-md-4">
					<img src="img/2605/file.png">
				</div>
				<div class="col-md-4">
				<div class="text_box3">
						<div id="mouse3"></div>
						<h2>Бесплатная доставка</h2>
						<p>Заполнив заявку на нашем сайте, мы доставим мишку за 2 часа. Так же мы осуществляем доставку по всей России, от 3 до 5 дней</p>
					</div>
					<div class="text_box4">
						<div id="mouse4"></div>
						<h2>Бесплатная доставка</h2>
						<p>Заполнив заявку на нашем сайте, мы доставим мишку за 2 часа. Так же мы осуществляем доставку по всей России, от 3 до 5 дней</p>
					</div>
				</div>
				
			</div>
		</div>

.section25 .text_box h2:hover{
	color: red;
	cursor: pointer;
	
}

.section25 #text_box, .section25 .text_box3 {
	margin-top: 50px;
	margin-bottom: 150px;
}

.section25 #mouse, .section25 #mouse2, .section25 #mouse3, .section25 #mouse4 {
        background-image: url(../../img/25/mouse2.png);
		width: 32px;
		height: 32px;
		position: absolute;
		left: -20px;
		background-repeat: no-repeat;
}    

.section25 .sub-line #circle{
	position: absolute;
    width: 15px;
    height: 15px;
    background-color: #d9d9d9;
    border-radius: 50%;
    top: 60px;
    left: 490px;
    cursor: pointer;
    -webkit-transition: background-color 500ms;
    transition: background-color 500ms;
	z-index: 1;
}

.section25 .sub-line #circle2{
	position: absolute;
    width: 15px;
    height: 15px;
    background-color: #d9d9d9;
    border-radius: 50%;
    bottom: -3px;
    right: -108px;
    cursor: pointer;
    -webkit-transition: background-color 500ms;
    transition: background-color 500ms;
	z-index: 1;
}

.section25 .sub-line #line{
	width: 0;
    height: 1px;
    position: absolute;
    left: 320px;
    top: 68px;
	z-index: 1;
	cursor: pointer;
    background-color: #d9d9d9;
    will-change: width;
    -webkit-transition: width 1000ms cubic-bezier(0.445, 0.05, 0.55, 0.95), background-color 500ms;
    transition: width 1000ms cubic-bezier(0.445, 0.05, 0.55, 0.95), background-color 500ms;
}

.section25 .sub-line #line2{
	width: 51px;
    height: 1px;
    position: absolute;
    bottom: -3px;
    right: -108px;
	z-index: 1;
	cursor: pointer;
    background-color: #d9d9d9;
    will-change: width;
    -webkit-transition: width 1000ms cubic-bezier(0.445, 0.05, 0.55, 0.95), background-color 500ms;
    transition: width 1000ms cubic-bezier(0.445, 0.05, 0.55, 0.95), background-color 500ms;
}

.section25 .sub-line #line:hover{
	width: 200px;
}

function changeItem() {
	document.getElementById('line').style.width = '170px';
	document.getElementById('circle').style.background = 'red';
	document.getElementById('mouse').style.backgroundPosition = '0 -32px';
}
	function rechangeItem() {
	document.getElementById('line').style.width = '0';
	document.getElementById('circle').style.background = '';
	document.getElementById('mouse').style.backgroundPosition = '';
}
  • Вопрос задан
  • 176 просмотров
Решения вопроса 1
dimovich85
@dimovich85 Куратор тега CSS
https://u-academy.net/
Вам надо при наведении мышкой скрыть блок? Это без js делается;) Поищите hover css
Ответ написан
Пригласить эксперта
Ответы на вопрос 1
IceRD
@IceRD
Положите .sub-line в #text_box и используйте this в контексте функции
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
16 мая 2024, в 23:36
200000 руб./за проект
16 мая 2024, в 23:10
12000 руб./за проект