Using Local Storage to set a class for user preference

后端 未结 1 907
挽巷
挽巷 2021-01-23 15:16

Please see \"Latest update\" below - Niel S has found a local storage solution for the VIEW MODE part of this question - but I still need to find a solution to

相关标签:
1条回答
  • 2021-01-23 15:39

    You don't have any code to load the localstorage value and apply the class to listings.

    I've updated your fiddle: https://jsfiddle.net/n2o70xgg/2/

    This is what I added:

     if (localStorage.getItem('viewmode') == 'alt') {
        $('.listings').addClass('alt');
    }
    
    0 讨论(0)
提交回复
热议问题