JSFiddle - React, Tailwind, and code Playground
by Tom DeBerardine
HTML
<div id="nav-aj" data-options='{"default":"t1","animation": {"duration": 500, "effects": "fade"}}'></div>
JavaScript
function updateDiv(hash) {
var $div = $('#nav-aj');
var options = $div.data('options');
switch (hash) {
case 'A':
options['default'] = 't1';
break;
case 'B':
options['default'] = 't2';
break;
default:
option['default'] = 't1';
}
$div.attr('data-options', options);
}
$(function () {
var hash = window.location.hash.split('#')[1]
updateDiv(hash);
$(window).on('hashchange', function () {
updateDiv(window.location.hash.split('#')[1]);
});
});