<script> $(document).ready(function () //on page load { $('area[title*="UPPER"]').each(function ()//get all areas { $(this).addClass("victory"); }); $('area[title*="LOWER"]').each(function ()//get all areas { $(this).addClass("lose"); }); //initialize highlight $('.map').maphilight({ strokeWidth: 0, fillColor: "0000FF", fillOpacity: 0.8, singleSelect: true }); ////map wrap $(".victory").click(function () { //This block is what creates highlighting by trigger the "alwaysOn", var data = $(this).data('maphilight') || {}; data.alwaysOn = !data.alwaysOn; $(this).data('maphilight', data).trigger('alwaysOn.maphilight'); //there is also "neverOn" in the docs, but not sure how to get it to work }); $('.map').maphilight({ strokeWidth: 0, fillColor: "FFFF00", fillOpacity: 0.8}); $(".lose").click(function () { //This block is what creates highlighting by trigger the "alwaysOn", var data = $(this).data('maphilight') || {}; data.alwaysOn = !data.alwaysOn; $(this).data('maphilight', data).trigger('alwaysOn.maphilight'); //there is also "neverOn" in the docs, but not sure how to get it to work }); }); </script>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)