Javascript rollovers
Introduction
In this tutorial, we will look at different ways to add javascript rollovers effects to HTML elements on a web page
Standard Javascript rollovers
On many web pages, javascript rollovers are handled by adding an onmouseover and onmouseout event on images.
- onmouseover is triggered when the mouse moves over an element
- onmouseout is triggered when the mouse moves away from the element
This is an example of how it works. Move your mouse over the arrow below:
This is the code used:
<img src="images/arrow.gif" onmouseover="this.src='images/arrow-over.gif'" onmouseout="this.src='images/arrow.gif'">
When the mouse moves over the images, the source of the image is set to arrow-over.gif(the green arrow). When the mouse moves away from the image, the source is reverted to the blue arrow(arrow.gif).
CSS rollovers with Javascript
Instead of changing the src attribute of an image, you can also use Javascript to change the css class of an element.
This is an example:
Move your mouse over me
This is the code used:
<style type="text/css">
.arrowOver{
background-repeat:no-repeat;
background-image:url('images/arrow-over.gif');
color:blue;
}
</style>
<p onmouseover="this.className='arrowOver'" onmouseout="this.className=''">Move your mouse over me</p>
When you move the mouse over the text, it will assign the element to the css class "arrowOver". This will apply all the layout defined in the <style> part above to this element, i.e. a background image and blue text. This styling will be removed when the mouse moves away from the text.
CSS styling with mootools
Mootools is one of many great libraries which makes it easier to work with Javascript. This is an example of how you can use mootools to add Javascript rollover effects:
Move your mouse over me
This is the code used for this example:
<style type="text/css">
.arrowOver, .standardArrow{
background-repeat:no-repeat;
}
p.arrowOver{
background-image:url('images/arrow-over.gif');
color:green;
}
.standardArrow{
background-image:url('images/arrow.gif');
color:blue;
}
</style>
<p class="standardArrow" onmouseover="$(this).addClass('arrowOver')" onmouseout="$(this).removeClass('arrowOver')">Move your mouse over me</p>
In this example, we are using two css classes, standardArrow and arrowOver.
An element on a web page can be assigned to more than one css class. In these cases, the styling you end up with will be a mix of these css classes. In the <style> part above, I have added a p. in front of arrowOver in order to give it precedence over standardArrow
When the mouse moves over the element, the css class arrowOver will be added to the element. When the mouse moves away from the element, it will be removed.
Automate it with Mootools
It always feels better to work with small and clean files instead of a large file containing a mix of HTML, Javascript and CSS. This is one of the reason why it's a good idea to have HTML, Javascript and CSS in separate files. It gives you more freedom and it also makes it much easier for you to maintain your site.
This is something we can accomplish by adding events dynamically, using plain Javascript or with a library like mootools.
Here, I want to show you how this can be done using Mootools.
Demo example - Move your mouse over the elements below:
Step 1: Plain HTML
The first thing we do is to write our plain HTML code:
<p class="standardArrow"><a href="#">Menu item 1</a></p>
<p class="standardArrow"><a href="#">Menu item 2</a></p>
<p class="standardArrow"><a href="#">Menu item 3</a></p>
<p class="standardArrow"><a href="#">Menu item 4</a></p>
As you can see, there is no Javascript here. All we have done is to create some <p> tags assigned to the standardArrow css class with some anchor tags inside it.
Step 2: CSS inside separate file
The next thing to do is to create a sub folder called css, and inside it a file called javascript-rollovers.css. This is the content of this file:
.arrowOver, .standardArrow{
background-repeat:no-repeat;
margin-bottom:0px;
margin-top:0px;
}
p.arrowOver{
background-image:url('../images/arrow-over.gif');
color:green;
}
.standardArrow{
background-image:url('../images/arrow.gif');
color:blue;
}
The css is almost identical to the one used in the previous example. We have only added a ../ prefix to the urls in order to have a relative paths from the css file.
Then we include this css file our web page using the <link> tag:
<link rel="stylesheet" href="css/javascript-rollovers.css">
Step 3: Javascript in separate file
We also create a sub folder called js which would be the folder for our Javascript code. Inside it, we create a new file called javascript-rollovers.js. This is the content of this file:
window.addEvent('domready', function() {
var els = $$('.standardArrow');
// Getting size of array as a variable for Javascript speed purpose
var countEls = els.length;
for(i=0;i<countEls;i++) {
els[i].addEvent('mouseover', arrowMouseover);
els[i].addEvent('mouseout', arrowMouseout);
}
});
function arrowMouseover(){
$(this).addClass('arrowOver');
}
function arrowMouseout(){
$(this).removeClass('arrowOver');
}
The first thing we do in this code is to add a domready event. This event will be triggered when the HTML or Document Object Model(DOM) of our web page has been loaded by the browser. When this happens, the function assigned to the event will be executed.
Inside this function, I'm creating an array of all elements on my page assigned to the css class standardArrow
var els = $$('.standardArrow');
The I loop through each of these elements and assign an onmouseover and onmouseout event to each of them.
els[i].addEvent('mouseover', arrowMouseover);
els[i].addEvent('mouseout', arrowMouseout);
When the mouse moves over the element, it will call the function named arrowMouseover and when the mouse moves away from it, it will call the function arrowMouseout.
These two function both consists of only one line. It simply adds and removes the arrowOver css class from the element triggering the event.
function arrowMouseover(){
$(this).addClass('arrowOver');
}
function arrowMouseout(){
$(this).removeClass('arrowOver');
}
The last thing we have to do is to include javascript-rollovers.js on our web page using the <script> tag:
<script type="text/javascript" src="js/javascript-rollovers.js"></script>
http://infobets.net
Education is very good and many knowledge
Набрав в поисковике Вы можете посетить наш сайт
и возможно приобрести кальяны и всё для них.
Доставка по всей России
Бесплатная консультация
Отправка в день заказа
Персональные скидки
Строго 18+
Мы всегда с Вами и стараемся нести только позитив и радость.
Ищите Нас в соцсетях,подписывайтесь и будьте в курсе последних топовых событий.
Строго 18+
Какой кальян купить новичку?
Если это первая покупка, то лучше начать с более простых моделей. Это изделия со средней высотой (70 см) и одной насадкой. Количество труб влияет на работу устройства. Это будет трудная задача.
Очень важно обращать внимание на материал шахты. Чем он прочнее, тем дольше прибор прослужит. Срок службы устройства минимум на 10 лет.
https://h-magic.su/mamun
Рекомендуется обращать внимание на внутренний диаметр шахты. Он должен быть минимум 12 см.
Можно рассмотреть также электронные изделия. Они компактные и простые в использовании. Безопасный дым. Его можно курить (парить) даже в общественных местах. Что касается его вкусовых качеств – они ничем не уступают традиционным устройствам. Какой электронный кальян купить лучше? Самый распространенный гаджет – площадь Sturbuzz.
#Hookahmagic
В настоящее время стало очень популярным курить кальяны. Это ему объяснение. Во-первых, кальян помогает снимать стресс. Во-вторых, люди, которые отказались от обычных сигарет или находятся в процессе отказа, используют кальян в качестве замены вредной привычки.
Приобрести кальян, аксессуары, табак для кальяна дешево можно в специализированном магазине. Продавцы консультанты всегда помогут подобрать лучший вариант. Но не все специалисты смогут ответить на главные вопросы курильщика: «Какие виды кальяна бывают?», «Сколько можно курить по времени?», «Почему иногда болит голова от кальяна?» и так далее. Всё это будет описано ниже в статье.
Какие бывают кальяны
В определенных барах персонал обычно начинают свой разговор с фразы: «Какой табак для кальяна вы бы хотели выбрать?». Но никогда не спрашивают какой кальян человек хотел бы покурить. Многие курильщики считают, что самое важное в таком процессе только лишь табак. Сами же кальяны обычно различают только по цвету и остальным внешним признакам. Курение могут испортить и другие факторы.
https://h-magic.su/flow
К таким можно отнести:
Бренд кальяна;
Материал изготовления;
Способ забивки;
Размер колбы.
Мы всегда с Вами и стараемся нести только позитив и радость.
Ищите Нас в соцсетях,подписывайтесь и будьте в курсе последних топовых событий.
Amy,Tortuga,Alfa Hookah...
Строго 18+
Мы всегда с Вами и стараемся нести только позитив и радость.
Ищите Нас в соцсетях,подписывайтесь и будьте в курсе последних топовых событий.
Строго 18+
Кальянный бренд Фараон давно завоевал сердца ценителей кальянной культуры вариативностью моделей кальянов,
приемлемым качеством и низкой ценовой политикой. Именно эти факторы играют главную роль в истории его успеха. Не упускайте очевидную выгоду и вы! Заказывайте кальян Pharaon (Фараон) 2014 Сlick в интернет-магазине HookahMagic и оформляйте доставку в любой регион РФ. Мы гарантируем быструю доставку и высокое качество предоставляемой продукции.
https://h-magic.su/pharaon
Удачных вам покупок!
Мы всегда с Вами и стараемся нести только позитив и радость.
Ищите Нас в соцсетях,подписывайтесь и будьте в курсе последних топовых событий.
Строго 18+
Какой кальян купить новичку?
Если это первая покупка, то лучше начать с более простых моделей. Это изделия со средней высотой (70 см) и одной насадкой. Количество труб влияет на работу устройства. Это будет трудная задача.
Очень важно обращать внимание на материал шахты. Чем он прочнее, тем дольше прибор прослужит. Срок службы устройства минимум на 10 лет.
https://h-magic.su/adalia
Рекомендуется обращать внимание на внутренний диаметр шахты. Он должен быть минимум 12 см.
Можно рассмотреть также электронные изделия. Они компактные и простые в использовании. Безопасный дым. Его можно курить (парить) даже в общественных местах. Что касается его вкусовых качеств – они ничем не уступают традиционным устройствам. Какой электронный кальян купить лучше? Самый распространенный гаджет – площадь Sturbuzz.
[url=https://parexscientificworks.com/2017/05/27/hello-world/#comment-1317]Заказывайте у лучших[/url] 8428f4f
https://ali.ski/ZPV0C1
Power BI is a business analytics tool from Microsoft.
It lets youvisualizeyour data and share insights across your organization,
or embed them in your app or website. Its interface is simple enough
for end users to create their own reports and dashboards.
It is ranked number one in Business Intelligence Tools.
Power BI provides cloud-based BI services, known as "Power BI Services",
along with a desktop based interface, called "Power BI Desktop".
It offers data warehouse capabilities including data preparation,
data discovery and interactive dashboards
How simple is this course?
90% of concepts are explained in button clicks,
which means no coding knowledge is required.
Making it EASIER THAN EXCEL
https://fas.st/PW7sBG
[url=http://18devok.ru/playboy/1896-dlinnonogaya-malyshka-iz-playboy-slushaet-muzyku-i-poziruet-goloy.html][img]http://18devok.ru/uploads/posts/2017-12/medium/1513499842_1414710196_ero-top.com_00.jpg[/img][/url]
смотреть бесплатно порно пизда фото, [url=http://trahsex.ru/damy-porno-foto/1109-ebet-mezhdu-grudey-i-v-mokruyu-pizdu-grudastuyu-damu.html]истекая спермой откровенное порно фото[/url]
http://trahsex.ru/
[url=http://18devok.ru/playboy/1896-dlinnonogaya-malyshka-iz-playboy-slushaet-muzyku-i-poziruet-goloy.html][img]http://18devok.ru/uploads/posts/2017-12/medium/1513499842_1414710196_ero-top.com_00.jpg[/img][/url]
фото группового секса, [url=http://18devok.ru/aktrisy-porno-foto/122-molodye-aktrisy-lesbiyanki-zanimayutsya-seksom-i-poluchayut-orgazm.html]ебет в мохнатую писю[/url]
http://18devok.ru/
[url=http://18devok.ru/playboy/1896-dlinnonogaya-malyshka-iz-playboy-slushaet-muzyku-i-poziruet-goloy.html][img]http://18devok.ru/uploads/posts/2017-12/medium/1513499842_1414710196_ero-top.com_00.jpg[/img][/url]
без регистрации фото порно малолетка занялась вагинальным сексом, [url=http://bdsmporno.ru/iznasilovanie-porno-foto/281-blondinku-v-chulkah-iznasilovali-v-pizdu-vo-vremya-bdsm-ebli.html]интим порно европейка занялась оральным сексом[/url]
http://bdsmporno.ru/
[url=http://18devok.ru/playboy/1896-dlinnonogaya-malyshka-iz-playboy-slushaet-muzyku-i-poziruet-goloy.html][img]http://18devok.ru/uploads/posts/2017-12/medium/1513499842_1414710196_ero-top.com_00.jpg[/img][/url]
brazzers photo, [url=https://go-girls.org/housewives/2342-zrelye-domohozyayki-erotichno-poziruyut-i-pokazyvayut-golye-siski.html]Фото траха азиаток бесплатно[/url]
https://go-girls.org/
[url=http://18devok.ru/playboy/1896-dlinnonogaya-malyshka-iz-playboy-slushaet-muzyku-i-poziruet-goloy.html][img]http://18devok.ru/uploads/posts/2017-12/medium/1513499842_1414710196_ero-top.com_00.jpg[/img][/url]
http://goliedamy.ru/
[url=http://krasivie-telki.ru/v-noskah-porno-foto/1692-sportsmenka-v-noskah-pokazyvaet-striptiz.html][img]http://krasivie-telki.ru/uploads/posts/2016-11/thumbs/1480106654_b00.jpg[/img][/url]
настоящее фото бесплатно голая жопа рыжей кудрявой женщины, [url=http://krasivie-telki.ru/onanizm-porno-foto/350-molodaya-golaya-blondinka-onaniruet-prozrachnoy-sek-igrushkoy.html]грязно порно фото бесплатно [/url]
http://krasivie-telki.ru/
[url=http://nedosex.ru/brat-ebyot-sestru-porno-foto/138-brat-ebet-sestru-ogromnym-chlenom-v-rot-i-pizdu-do-spermy-na-lico.html][img]http://nedosex.ru/uploads/posts/2016-02/medium/1456389759_image_11625.jpg[/img][/url]
http://nedosex.ru/
[url=http://pornoya24.ru/znamenitosti-porno-foto/3009-nathalie-kelley-svetit-torchaschimi-siskami-v-basseyne.html][img]http://pornoya24.ru/uploads/posts/2019-07/medium/1563525346_1.jpg[/img][/url]
фото дочь дрочит папе член, [url=http://pornoya.ru/blondinki-porno-foto/1207-seksualnaya-golaya-blondinka-s-volosatym-lobkom-zanimaetsya-vaginalnym-seksom.html]откровенное бесплатное порно занимается комбинированным сексом[/url]
http://pornoya24.ru/
[url=https://realnoe-porevo.ru/v-chulkah-porno-foto/1311-appetitnaya-popka-i-seksualnye-chulki-na-malyshke.html][img]https://realnoe-porevo.ru/uploads/posts/2016-08/medium/1471625474_image-209.jpg[/img][/url]
https://realnoe-porevo.ru/
[url=http://zashibisporno.ru/glamurnye-blyadi-porno-foto/2272-glamurnuyu-blyad-s-uprugimi-siskami-trahayut-v-mashine.html][img]http://zashibisporno.ru/uploads/posts/2017-04/thumbs/1493067699_image-1547.jpg[/img][/url]
в чулках с двойным проникновением бесплатно фото, [url=http://zashibisporno.ru/eblya-v-rot-porno-foto/1876-eblya-v-rot-i-volosatuyu-pisku-so-staruhoy.html]с толстым хуем на кровати фото бесплатно[/url]
http://zashibisporno.ru/
[url=https://18devok.ru/playboy/11-erotichnye-snimki-devushki-playboy-s-bolshimi-siskami-v-golom-vide.html][img]https://18devok.ru/uploads/posts/2015-12/1449595395_image-266.jpg[/img][/url]
порно фоты старых грузинок с седыми волосами на лобке, [url=http://18devok.ru/chastnoe-porno-foto/597-glamurnaya-shatenka-na-chastnyh-foto-na-kablukah-snimaet-bikini.html]валасатая пизда азербаджанки секс фото[/url]
https://18devok.ru/
[url=http://bdsmporno.ru/devushki-porno-foto/1630-devushka-v-beloy-mayke-delaet-minet-i-dolbitsya-na-krovati.html][img]http://bdsmporno.ru/uploads/posts/2019-06/1561687963_1.jpg[/img][/url]
фото порно интим с рыжей девушкой, [url=http://bdsmporno.ru/seks-v-posteli-porno-foto/448-analnyy-seks-v-posteli-s-russkoy-blondinkoy-s-minetom-i-kuni.html]домашний минет и сперма смотреть порно[/url]
http://bdsmporno.ru/
[url=https://goliedamy.ru/vobsestv/1607-kudryavaya-shkolnica-v-obschestvennom-meste-vozbuzhdaet-pilotkoy.html][img]http://siskiphoto.ru/uploads/posts/2016-05/medium/1462225265_image-1533.jpg[/img][/url]
настоящие фото смотреть латинка с большими сиськами, [url=http://goliedamy.ru/kitayanki-porno-foto/261-krovatnyy-seks-s-kitayankoy-s-tatuirovkoy-i-malenkoy-grudyu.html]порнофото толстых бесплатно[/url]
https://goliedamy.ru/
[url=http://hdpornodevki.ru/1659-arhiv-devushek-na-rabochiy-stol-i-porno-aktris-v-dorogih-trusikah.html][img]http://hdpornodevki.ru/uploads/posts/2016-05/medium/1462390080_image_786.jpg[/img][/url]
грудастая в одежде секретарша минет вся в сперме, [url=http://hdpornodevki.ru/1215-krasivaya-gimnastka-s-appetitnoy-zadnicey-i-malenkimi-titkami-poziruet.html]интим фото транвеститов[/url]
http://hdpornodevki.ru/
[url=http://krasivie-telki.ru/v-noskah-porno-foto/1691-krasotki-v-noskah-poziruyut-v-yubkah-i-golymi.html][img]http://krasivie-telki.ru/uploads/posts/2016-11/1480106566_image_282.jpg[/img][/url]
фото бесплатно позирующей голой на природе, [url=http://krasivie-telki.ru/na-otkrytom-vozduhe-porno-foto/1000-molodaya-bryunetka-zanimaetsya-vaginalnym-seksom-na-otkrytom-vozduhe.html]онлайн порно фото развратная проститутка в сексуальном белье[/url]
http://krasivie-telki.ru/
[url=http://nedosex.ru/brat-ebyot-sestru-porno-foto/137-brat-ebet-sestru-na-kuhne-posle-glubokogo-mineta.html][img]http://nedosex.ru/uploads/posts/2016-02/medium/1456389682_image_11546.jpg[/img][/url]
http://nedosex.ru/
[url=http://devstvennici-porno.ru/galerei-porno-foto/1982-galereya-fotok-s-pyshnoy-suchkoy-s-bolshimi-siskami.html][img]http://devstvennici-porno.ru/uploads/posts/2017-09/1505894278_image_32.jpg[/img][/url]
откровенное фото порно инцест с пьяной девкой, [url=http://porno-devstvennici.ru/russkaya-eblya-porno-foto/1449-maloletka-vo-vremya-russkoy-ebli-podstavila-ochko.html]взрослая брюнетка с маленькими грудями откровенное фото смотреть[/url]
http://devstvennici-porno.ru/
[url=http://porno-soski.ru/v-klube-porno-foto/1633-studencheskaya-gruppovaya-eblya-devchushek-svingerov-v-klube.html][img]http://porno-soski.ru/uploads/posts/2016-05/1464165866_image_223.jpg[/img][/url]
leopard print tattoo pornstars nude, [url=http://porno-soski.ru/realnoe-porno-foto/1988-na-realnom-porno-hudaya-zhena-ebetsya-v-missionerskoy-poze.html]смотреть секс в школе порно [/url]
http://porno-soski.ru/
[url=https://trahsex.ru/gornichnye-porno-foto/1593-miluyu-gornichnuyu-na-kablukah-trahaet-v-anus.html][img]https://trahsex.ru/uploads/posts/2016-04/medium/1462046905_1416491331_analnaya-rabota-sluzhankoy_1_sexs-foto.com.jpg[/img][/url]
ебётся с негром в попку бесплатно порно, [url=http://trahsex.ru/blondinki-porno-foto/1542-blondinka-trahaetsya-v-posteli-i-lyubit-chuvstvovat-huy-v-piske.html]найти картинки жесткий секс[/url]
http://trahsex.ru/
[url=https://v-poze-rakom.ru/devicy/1660-moloduyu-devicu-ebet-v-ochko-po-sobachi.html][img]https://v-poze-rakom.ru/uploads/posts/2017-03/medium/1490772079_image_4642.jpg[/img][/url]
трахается с европейцем на кровати настоящее порно фото, [url=https://v-poze-rakom.ru/xardkor/]любительские фото горячей ебли[/url]
https://v-poze-rakom.ru/
[url=http://zashibisporno.ru/glamurnye-blyadi-porno-foto/1788-dvoynoe-proniknovenie-dlya-glamurnoy-blyadi.html][img]http://zashibisporno.ru/uploads/posts/2016-09/medium/1472791124_image-1506.jpg[/img][/url]
ебля женщин с маленькими сисями, [url=http://zashibisporno.ru/retro-erotika-porno-foto/2160-v-retro-erotike-glamurnye-suki-trahayutsya-krasivo.html]Чёрный хуй во рту и волосатой пизде смотреть онлайн фото[/url]
http://zashibisporno.ru/
[url=http://bdsmporno.ru/devushki-porno-foto/1629-tri-pyanye-devushki-zanimayutsya-seksom-drug-s-drugom.html][img]http://bdsmporno.ru/uploads/posts/2019-06/1561687938_2.jpg[/img][/url]
фото инцест, [url=http://bdsmporno.ru/seks-v-posteli-porno-foto/904-seksualnaya-telka-s-tatu-zanimaetsya-seksom-v-posteli.html]кремпай с женских писек интим порно[/url]
http://bdsmporno.ru/