You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
1.5 KiB
JavaScript

5 years ago
$('.agreement').click(function(){
var word = $(this).text();
alert(word);
});
$('.chosen_words').hover(function(){
var word = $(this).text();
toggleClass(word);
});
$('.agreement').hover(function(){
$( this ).css('background-color', 'pink');
}).;
$('div').hover(function() {
$(this).attr(class).css('border','2px solid red');
}, function() {
$(this).attr(class).css('border',' ');
});
$(document).ready(function() {
$('div').hover(function() {
$(this).attr(class).css('border','2px solid red');
}, function() {
$(this).attr(class).css('border',' ');
});
var highlight = document.getElementsByClassName("agreement");
for (var i = 0; i < highlight.length; i++) {
highlight[i].addEventListener("mouseover", highlightThem);
highlight[i].addEventListener("mouseout", DontHighlightThem);
}
function highlightThem() {
for (var i = 0; i < highlight.length; i++) {
highlight[i].classList.add("highlight");
}
}
function DontHighlightThem() {
for (var i = 0; i < highlight.length; i++) {
highlight[i].classList.remove("highlight");
}
}
#image click
var images = document.querySelectorAll('.img');
for (var i=0; i < images.length; i++) {
images[i].addEventListener('click', function () {
if (this.parentElement && this.parentElement.tagName.toLowerCase() == 'div') {
this.parentElement.classList.toggle('img_clicked');
} else {
this.classList.toggle('img_clicked');
}
})
}