Search
Close this search box.
Search
Close this search box.

Useful snippets

How to check if a div exists with jQuery

<script>
    $(document).ready(function(){
        if ($('#my_div_id').length) {
            // div found
        }
    });
</script>

Running a function with jQuery when the window is resized

<script>
    $(document).ready(function() {

        onStageResize();

        $(window).resize(function() {
            onStageResize();
        });
        
        function onStageResize() {
             // do something here
         }
     });
 </script>