Answer the question
In order to leave comments, you need to log in
Is it possible to use an array of objects as the value of one of the JSON name/value pairs?
There is a json object.
var post = {
"images" : [
{"img" : "img/1.jpg",
"img-desc" : "Описание к первому изображению"},
{"img" : "img/2.jpg",
"img-desc" : "Описание ко второму изображению"},
{"img" : "img/3.jpg",
"img-desc" : "Описание к третьему изображению"}
]
}
<div ng-repeat="image in post.images">
<img ng-src="{{image.img}}">
<p>{{image.desc}}</p>
</div>
<p>{{post.images[1].img-desc}}</p>
Answer the question
In order to leave comments, you need to log in
First, differences in style must be carried out in classes.
.btn-change-sect {
display: none;
border-bottom: 2px solid #ffffff;
}
.active {
display: block;
border-bottom: 2px solid #ff7300;
}
$( ".btn-change-sect" ).click(function() {
// убираем активный стиль со всех подобных элементов
$( ".btn-change-sect" ).removeClass("active");
// ставим активный стиль текущему элементу
$(this).addClass("active");
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question