props: [ 'value', 'placeholder' ],
<div>
<input
:class="value ? 'input_filled' : ''"
:value="value"
@input="$emit('input', $event.target.value)"
>
<span>{{ placeholder }}</span>
</div>
filters: [
{ name: 'calculator.brand_filter', getter: obj => obj.brand.name, value: '' },
{ name: 'calculator.company_filter', getter: obj => obj.company.name, value: '' },
{ name: 'calculator.country_filter', getter: obj => obj.brand.country, value: '' },
{ name: 'calculator.side_filter', getter: obj => obj.sides, value: '' },
],
computed: {
filteredProfiles() {
return this.filters.reduce((profiles, { value, getter }) => {
return value
? profiles.filter(n => getter(n) === value)
: profiles;
}, this.profiles);
},
Vue.component('filter-select', {
props: [ 'name', 'options', 'value' ],
template: `
<div>
<p>{{ name }}<p>
<select :value="value" @change="$emit('input', $event.target.value)">
<option value="">-</option>
<option v-for="n in options">{{ n }}</option>
</select>
</div>`
});
computed: {
filterOptions() {
return this.filters.map(n => [...new Set(this.profiles.map(n.getter))]);
},
<filter-select
v-for="(n, i) in filters"
v-model="n.value"
:options="filterOptions[i]"
:name="trans(n.name)"
></filter-select>
methods: {
resetFilters() {
this.filters.forEach(n => n.value = '');
},
<button @click="resetFilters">{{ trans('calculator.reset_filter') }}</button>
let toBlock = document.querySelector('.section').getBoundingClientRect().top;
console.log(toBlock); (высота до до блока)
window.addEventListener('scroll', () => {
window.scrollTo({
top: toBlock,
behavior: "smooth"
});
})
document.querySelectorAll('.container').forEach(n => {
const slider = new Swiper(n.querySelector('.product-slider'), {
navigation: {
nextEl: n.querySelector('.swiper-button-next'),
prevEl: n.querySelector('.swiper-button-prev'),
},
spaceBetween: 10,
});
const thumbs = new Swiper(n.querySelector('.product-thumbs'), {
spaceBetween: 5,
centeredSlides: true,
slidesPerView: 4,
touchRatio: 0.2,
slideToClickedSlide: true,
direction: 'vertical',
});
slider.controller.control = thumbs;
thumbs.controller.control = slider;
});
input[type="radio"]:checked + label {
background: #FF0000;
box-shadow: 60px 30px 0 0 blue, 60px -30px 0 0 blue;
position: relative;
z-index: 1;
}
label {
transition: ease box-shadow .3s;
}
кастомные свойства для иконки прописал...
$('#phone').on('change', function(){
var count = ($('#phone').val().match( /\d+/g ).join('')).length;
console.log(count);
});
.startGrid {
display: -ms-grid;
-ms-grid-columns: 32% 20px 32% 20px 32%;
-ms-grid-rows: auto 20px auto 20px auto;
}document.querySelector('.selectTime').addEventListener('change', function() {
const values = Array.from(this.querySelectorAll('select'), n => n.value);
values[0] = `${-~values[0] % 24}`;
document.querySelector('куда там вам надо записать время').innerText = values
.map(n => n.padStart(2, 0))
.join(':');
});
<div class="accordionFaq"></div>
const playersOptions = [
{ source: '...' },
{ source: '...' },
...
];
$('.accordionFaq').html(playersOptions.map((n, i) => `
<div class="accordionFaq-item">
<div class="accordionFaq-head js-accordionFaq-head">
Video #${i}
</div>
<div class="accordionFaq-body">
<div id="player${i}"></div>
</div>
</div>
`).join('')).on('click', '.accordionFaq-head', function(e) {
const index = $(this).closest('.accordionFaq-item').index();
$('.accordionFaq-item', e.delegateTarget).each(function(i) {
const
$this = $(this),
isClicked = i === index,
active = isClicked && !$this.hasClass('active');
$(this)
.toggleClass('active', active)
.find('.accordionFaq-body')
[isClicked ? 'slideToggle' : 'slideUp']();
playersOptions[i].player[active ? 'play' : 'pause']();
});
});
playersOptions.forEach((n, i) => {
n.player = new Clappr.Player({
source: n.source,
parentId: `#player${i}`,
});
});
var pos = this.getAttribute('data-goto'); myMap.panTo(pos, {
data-goto="[59.938531, 30.313497]"
this.getAttribute('data-goto')
---> JSON.parse(this.dataset.goto)
$('select').select2({
minimumResultsForSearch: Infinity,
dropdownParent: $('.card-more'),
});