I have both $(document) and $(window), they are bound with 'ready' and 'resize' event respectively. They are sharing the same event handler.
Code:
$(window).on('resize', function () {
Shared code
});
$(document).ready(function () {
Shared code
});
Instead of the style above, is there a conventional way of handling this to make the code clean and simple>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…