How Can I save the toggled class into HTML 5 local storage?
This is my simple toggle function:
/* Toggle */
$('.bar-toggle').on('click',function(){
$('.container').toggleClass('with_toggle');
});
I don't really understand how to use the local storage and all the examples I came across use the .hide and .show and cannot find anything related to toggleClass
I wouldn't want to use the .show and .hide as they are costly for the browser but just take advantage of my toggle class...
fiddle:
fiddle example
codepen:
http://codepen.io/anon/pen/oLvNgB
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…