Hi wattyrev, you are right. The code does not do anything because, when used in a text widget, it is loaded before the fancybox call instead of after it. I should have thought of that...
This code should work (I tested it this time) :
<script type="text/javascript">
if(window.innerWidth < 500 || window.innerHeight < 500 || window.outerWidth < 500 || window.outerHeight < 500 ) {
easy_fancybox_handler = null;
};
</script>