// rollover image $(function(){ $(window).on('load', function(){ if ($('#rollover li a').hasClass('current')) { $('a.current img').each(function(){ $(this).attr('src', $(this).attr('src').replace('_off', '_on')); $(this).attr('srcset', $(this).attr('srcset').replace('_off', '_on')); $(this).attr('srcset', $(this).attr('srcset').replace('_off@2x', '_on@2x')); }); } }); $('#rollover li a').hover(function(){ $('img',this).attr('src', $('img',this).attr('src').replace('_off', '_on')); $('img',this).attr('srcset', $('img',this).attr('srcset').replace('_off', '_on')); }, function(){ if (!$(this).hasClass('current')) { $('img',this).attr('src', $('img',this).attr('src').replace('_on', '_off')); $('img',this).attr('srcset', $('img',this).attr('srcset').replace('_on', '_off')); } }); $('#rollover a').hover(function(){ $('img',this).attr('src', $('img',this).attr('src').replace('_off', '_on')); $('img',this).attr('srcset', $('img',this).attr('srcset').replace('_off', '_on')); }, function(){ if (!$(this).hasClass('current')) { $('img',this).attr('src', $('img',this).attr('src').replace('_on', '_off')); $('img',this).attr('srcset', $('img',this).attr('srcset').replace('_on', '_off')); } }); });