I am checking the device width and showing some option in menu. I need to check this while page loading and resizing. Because I need to check in devices in portrait and landscape view.
<script type="text/x-jsrender" id="option">
<ul class="dropdown-menu" role="menu">
{{if ~checkDevice()}}
<li>
<span class="btn"></span>
Show
</li>
{{/if}}
<script type="text/javascript" language="javascript">
$(document).ready(function () {
$.views.helpers({
checkDevice: function () {
return window.innerWidth > 450;
}
});
});
This working correctly in on load. How to check this if condition on resize ?