What do you think about page-specific interactions loaded in external file(json)?
Let say
{
"2d22, 2d23, 2d24": {
"id": "wbreai",
"trigger": "click",
"target": "popup",
"templateId": "5721",
"action": "show"
},
"2d25": {
"id": "uniqueId2",
"trigger": "hover",
"target": "element",
"templateId": "1234",
"action": "hide"
},
// more interactions
}
so our DOM may be like so
<div data-interaction-id="2d22">Element 1</div>
<div data-interaction-id="2d23">Element 2</div>
<div data-interaction-id="2d24">Element 3</div>
<div data-interaction-id="2d25">Element 4</div>
<!-- and so on-->
In this scenario interactions may be easily reused (no duplicates), json file cached and DOM will be cleaner…
What are your thoughts?