Изменение логотипа при прокрутке страницы
При скроллинге страницы изображение (логотип) меняет свой внешний вид.
ВАРИАНТ 1
- В место, где хотим поставить логотип, например, в файле index.php:
HTML
<div class="cont"><div class="logo">Header</div><div class="spacer"></div></div>
- В файл стилей .css ставим стили:
CSS
body {
margin: 0;
}
.cont {
position: relative;
height: 2000px;
background: #eee;
}
.logo {
position: relative;
height: 200px;
background: url(http://вашсайт.ru/images/banners/logo1.png);
color: #fff;
background-repeat:no-repeat;
}
.scrolled .logo {
position: fixed;
top: 0; left: 0;
width: 100%; height: 50px;
background: url(http://вашсайт.ru/images/banners/logo2.png);
float:left;
background-repeat:no-repeat;
}
.scrolled .spacer {
height: 100px;
}
- Создаем файл с расширением js (например, scrol.js) , закидываем туда код:
JS
$(window).on("scroll", function () {
var scrolled = $(this).scrollTop();
if( scrolled > 107 ) {
$('.cont').addClass('scrolled');
}
if( scrolled <= 107 ) {
$('.cont').removeClass('scrolled');
}
});
- Подключаем между тегами< Head> в файле index.php относительный или абсолютный путь к ява скрипту:
<script type="text/javascript" src="js/scrol.js"></script>
ВАРИАНТ 2
Теперь вариант, где логотип умещается в пределах сайта и не прижимается к левому краю экрана:
Основной логотип ставим в нужное место и не трогаем его. Он уйдет вместе с прокруткой.
А дополнительный логотип добавляем только в позиции скролл, в начальной позиции background будет пустой. При прокрутке он будет появляться.
В index.php ставим код:
HTML
<p align="center"><a href="/"><img alt="" src="http://вашсайт.ru/images/banners/logo1.png"></a></p>
-это наше первоначальное лого. Оно никуда не уходит, просто уходит вверх при прокрутке.
Этот код я поместила в контейнер сайта, чтобы он не уходил за его пределы (под сомнением)
HTML
<div align="center" width=100%>
<div class="cont">
<div class="logo"></div> - начальная позиция лого нет, в стилях его тоже не указываем.
<div class="spacer"></div>
</div></div>
В файл css добавляем стили:
CSS
.logo {
position: relative;
color: #fff;
background-repeat:no-repeat;
max-width: 100%;
}
.scrolled .logo {
position: fixed;
top: 0;
width: 1100px; height: 60px;
background: url(http://вашсайт.ru/images/banners/logo2.png);
background-repeat:no-repeat;
background-color: #161616;
z-index: 1000;
}
.scrolled .spacer {
height: 100px;
}
САЛАТ ПРАЗДНИЧНЫЙ и ВСЕ ТАК ПРОСТО
ХОЛОДНЫЙ ЛЕТНИЙ СУПЧИК
Бензогенераторы на 220-380V Subaru и их срочный ремонт, сервиса рядом нет, разбираем сами
Browse over 500 000 of the best porn galpleries, daily updated collections
http://lexixxx.com/?tanya
arican porn james and big brother and porn porn sex orgasm film free exhibitionst porn porn blow job deepthroat free
Последние данные о короне, по информации официальных государственных источников ВОЗ — https://coronavirus-control.ru/coronavirus-maldives/
Это важно!
Browse over 500 000 of the best porn galleries, daily updated collections
http://spearspornmovie.alypics.com/?essence
tacoma wa 98444 porn pics completel free interracial porn cheerleader strapon porn gay thing porn joey lynn tampa porn
поездки зарубеж
http://knigaturizma.ru/description.asp?company=3005618
Sexy photo galleries, daily updated pics
http://busty.hot.tits.hotblognetwork.com/?ayla
you porn new princess one piece porn velma porn pics speculum porn photos hot free amateur porn upload pictures
Drug information for patients. What side effects? seroquel without ption
Some information about medication. Get information here.
Meds information leaflet. Generic Name.
viagra tablets
Actual about pills. Get here.
Medicament information sheet. What side effects?
zantac prices in USA
Best about medicines. Read now.
Drugs information for patients. Drug Class.
where buy flomax in US
All information about drug. Read information here.
Medicament information leaflet. Brand names. where can i get viagra without rx in Canada. Everything news about drug. Read now.
САЛАТ ИЗ БАКЛАЖАН И КАБАЧКОВ
Pills information. Cautions. get trazodone online All what you want to know about pills. Read now.
http://cv-gl-1.ru/
Scandal porn galleries, daily updated lists
http://hotblognetwork.com/?alisha
free full horse porn free pirece porn porn adult tv big tits sarah gitter porn free porn full movies teen
Бутерброды с каемочкой
betwinner promo code nigeria 2021
Pills information sheet. What side effects can this medication cause?
can i buy baclofen
All about meds. Get information now.
Drug information sheet. Generic Name.
zantac pills https://zantac4u.top in the USA
All about medication. Get information here.
Pills information for patients. What side effects?
prednisolone pill https://prednisolone4u.top in USA
Everything what you want to know about medicine. Read now.
банкротство физических лиц рязань
генератор для сварочного аппарата
Teen Girls Pussy Pics. Hot galleries
http://oldtubeporn.lexixxx.com/?regan
amature animal porn tube pinup girl lesbian porn jenna jameson queen of porn shemale crossdreser pics porn elana doing herself good porn
photo
video
варочный котел
тестоотсадочная машина
weapon
zooporn
Строительство частных домов из газобетона Пермь в 2021 г
бисквит на горячем молоке
крем чиз на масле
New sexy website is available on the web
http://shemalebbmpin.bestshemaletube.instakink.com/?taylor
xxx halo porn pics deviant sex porn free blindfold porn tube arab piss porn female marine porn
drivingsite.ru