Skip to content Skip to sidebar Skip to footer

Calling Image Onload Inside A Loop With Global Variable

The variable menuitems is a key value pair. The key contains the name and the value contains the Image url. The idea is to store the below URL in the localstorage. Local Storage

Solution 1:

...stuff...

    bannerImage.src = value.menu_icon;
    bannerImage.attr('data-my-session-name', menu_icon_session_name);
    bannerImage.onload = function () {
        imgData = getBase64Image(this);
        localStorage.setItem($(this).attr('data-my-session-name'), imgData);            

...stuff...

Post a Comment for "Calling Image Onload Inside A Loop With Global Variable"