У меня есть форма поиска с id sbox и контрольный список под ним. Я хотел бы установить событие ввода или фокусировку мыши, так что, когда кто -то выбран мышью в Sbox Div, первый элемент контрольного списка был пробитым. Он сейчас не работает на моем сайте. Мой jQuery ниже, но событие Enter Mouse не работает. Я также попробовал событие Focus, но оно не работает. < /P>
Редактировать: добавлен CSS позже на < /p>
$(document).ready(function() {
$("#sbox").on('mouseenter', function() {
$("#item_0").prop("checked", true);
});
$(".website_checklist").contents().find(":checkbox").bind("change", function() { // Find all checkboxes in the div website_checklist on change
val = this.checked, $(this).parent().toggleClass("checked"); // Give this item the class "checked"
});
$(".website_checklist").contents().find(":checkbox").bind("focus", function() { // Find all checkboxes in the div website_checklist on bind
val = this.focused, $(".focus").removeClass("focus"), $(this).parent().addClass("focus"); // Remove all focus and then add focus class to this one
});
setTimeout(function() {
$("#calcsuccess").fadeOut("slow");
}, 3000);
$("#sbox").on("paste", function() {
setTimeout(function() {
$("#button-addon2").trigger("click");
});
});
var value = $('#sbox').val();
if (!$.trim(value) || value === null) {
$('#button-addon2').hide();
$('#image-upload').show();
} else {
$('#button-addon2').show();
$('#image-upload').hide();
}
});
function buttonChange(val) {
if (val) {
$('#button-addon2').show();
$('#image-upload').hide();
} else {
$('#button-addon2').hide();
$('#image-upload').show();
}
}< /code>
.website_checklist p {
padding-bottom: 0;
font-size: 20px;
color: #1d0d6f;
padding: 20px 20px 5px 20px
}
.website_checklist ul {
list-style: none !important;
/* Remove the list style */
padding: 15px 0 0 0 !important
}
.website_checklist ul label {
font-size: 16px;
line-height: 1.4;
padding: 13px 24px 13px 64px;
display: block;
position: relative;
z-index: 100;
cursor: pointer
}
.website_checklist ul input,
.website_checklist ul li.focus:before {
left: 0;
top: 0;
position: absolute
}
.website_checklist li {
position: relative
}
.website_checklist ul li.focus:before {
left: 0;
top: 0;
position: absolute
}
.website_checklist ul input {
opacity: 0
}
.website_checklist ul li.focus:before,
.website_checklist ul span.input:before {
content: ""
}
.website_checklist ul span.input {
background-image: linear-gradient(90deg, #1d0d6f 0, #5430ce 100%);
background-color: #1d0d6f;
width: 26px;
height: 26px;
left: 24px;
top: 10px
}
.website_checklist ul span.input:before {
width: 22px;
height: 22px;
top: 2px;
left: 2px
}
.website_checklist ul span,
.website_checklist ul span:after,
.website_checklist ul span:before {
display: block;
position: absolute;
background: #fff;
border-radius: 50%
}
.website_checklist ul li.checked span.input {
/* CSS to make the background green when checked - we add the class checked using javascript */
background: #0af2a5
}
.website_checklist ul li.checked span.input:before {
background: #0af2a5
}
.website_checklist ul li.checked label {
/* when checked, make the text have a line through */
text-decoration: line-through
}
.website_checklist ul li.checked.focus:before {
background: #888
}
.website_checklist ul li.focus {
background: #fafafa
}
.website_checklist ul li.checked {
background: #f1f1f1
}< /code>
»
[img]assets/images/camera.png[/img]
[h4]Pre-launch checks[/h4]
[list]
[*]List item 1
[*]List item 2
[*]List item 3
[/list]
У меня есть форма поиска с id sbox и контрольный список под ним. Я хотел бы установить событие ввода или фокусировку мыши, так что, когда кто -то выбран мышью в Sbox Div, первый элемент контрольного списка был пробитым. Он сейчас не работает на моем сайте. Мой jQuery ниже, но событие Enter Mouse не работает. Я также попробовал событие Focus, но оно не работает. < /P> Редактировать: добавлен CSS позже на < /p>
$(".website_checklist").contents().find(":checkbox").bind("change", function() { // Find all checkboxes in the div website_checklist on change val = this.checked, $(this).parent().toggleClass("checked"); // Give this item the class "checked" }); $(".website_checklist").contents().find(":checkbox").bind("focus", function() { // Find all checkboxes in the div website_checklist on bind val = this.focused, $(".focus").removeClass("focus"), $(this).parent().addClass("focus"); // Remove all focus and then add focus class to this one });
.website_checklist ul span, .website_checklist ul span:after, .website_checklist ul span:before { display: block; position: absolute; background: #fff; border-radius: 50% }
.website_checklist ul li.checked span.input { /* CSS to make the background green when checked - we add the class checked using javascript */ background: #0af2a5 }
.website_checklist ul li.checked span.input:before { background: #0af2a5 }
.website_checklist ul li.checked label { /* when checked, make the text have a line through */ text-decoration: line-through }
.website_checklist ul li.checked.focus:before { background: #888 }
.website_checklist ul li.focus { background: #fafafa }
.website_checklist ul li.checked { background: #f1f1f1 }< /code>