I am a jQuery beginner and I need assistance creating a dictionary list.
The challenge I face is that each definition should be displayed under its own row of 3 words on desktop, 2 words on tablet, and as a single word in an accordion system on mobile. Only one definition should be visible at a time, toggling when clicked.
Wordpress will be used to add words dynamically, so the list must adjust accordingly.
Here is my incomplete test code: https://jsfiddle.net/Xroad/qbh79xoy/31/
$('.tabs .tab-link').each(function (index, item) {
$(item).attr('data-link', index);
});
$('.tab-content .tab-content').each(function (index, item) {
$(item).attr('data-content', index);
});
$('.tabs .tab-link').click(function () {
$('.tabs .tab-link').not(this).removeClass('current');
$(this).toggleClass('current');
});
I am unsure how to display each definition under a row of 3 words. Can someone please provide guidance? Thank you in advance.
DESKTOP VERSION
https://i.sstatic.net/105oo.jpg
MOBILE VERSION