Topic: Rotate Card by Link instead of whole card
Michal Szymanski
staff pro premium priority answered 10 years ago
/* ROTATING CARDS */
(function () {
var cards = document.querySelectorAll(".card1.effect__click");
for (var i = 0, len = cards.length; i < len; i++) {
var card1 = cards[i];
clickListener(card1);
}
function clickListener(card) {
card.addEventListener("click", function () {
var c = this.classList;
c.contains("flipped") === true ? c.remove("flipped") : c.add("flipped");
});
}
})();
dward
answered 10 years ago
Michal Szymanski
staff pro premium priority answered 10 years ago
<script>
$('button').click(function () {
$('.card1').toggleClass('flipped');
});
</script>
Where 'button" is a button which you use to flip the card.
It's enough you add this code below script section. But it will still rotate also when clicking a card.
If you want to keep only 'button' way, you have to remove this code from MDB.js file:
/* ROTATING CARDS */
(function () {
var cards = document.querySelectorAll(".card1.effect__click");
for (var i = 0, len = cards.length; i < len; i++) {
var card1 = cards[i];
clickListener(card1);
}
function clickListener(card) {
card.addEventListener("click", function () {
var c = this.classList;
c.contains("flipped") === true ? c.remove("flipped") : c.add("flipped");
});
}
})();
Michal Szymanski
staff pro premium priority answered 10 years ago
Daniel
pro answered 10 years ago
Daniel
pro answered 10 years ago
Dawid Adach
pro answered 10 years ago
Fitrepreneur
pro answered 9 years ago
Michal Szymanski
staff pro premium priority answered 9 years ago
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Pro
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No