Answer the question
In order to leave comments, you need to log in
How to add two classes to two objects in one click?
There is a script:
$(document).ready(function(){
$('.logo_block').click(function () {
$(".line-relative").addClass('line-topp');
});
});
Answer the question
In order to leave comments, you need to log in
Let's add two properties - the number of elements on the page (i.e., how many elements should be shown at a time) and the number of the current page:
perPage: 10, // или 20, или 50, это вам виднее... да и настраиваемым можно его сделать
page: 1,
pages() {
return Math.ceil(this.items.length / this.perPage);
},
pageData() {
const end = this.page * this.perPage;
return this.items.slice(end - this.perPage, end);
},
<div v-for="item in pageData">
...
goTo(page) {
this.page = Math.max(1, Math.min(this.pages, page));
},
next(change) {
this.goTo(this.page + change);
},
<button @click="goTo(1)">в начало</button>
<button @click="next(-1)">предыдущая страница</button>
<button @click="next(+1)">следующая страница</button>
<button @click="goTo(pages)">в конец</button>
Do you want to read the documentation about taking elements by index, or can you guess?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question