so i have this function:
(function() {
    var wwidth = $(window).width();
    function headroom() {
        // headroom
        $("nav").headroom({
            "tolerance" : 0,
            "offset" : 1300,
        });
        // to destroy
        $("nav").headroom("destroy");
    }
    function headroomMobile() {
        // headroom
        $("#nav-wrap").headroom({
            "tolerance" : 0,
            "offset" : 200,
        });
        // to destroy
        $("#nav-wrap").headroom("destroy");
    }
    if (wwidth >= 480) {
        headroom();
    }
    if (wwidth < 480) {
        headroomMobile();
    }
})();
i would this function to repeat everytime there's a window resize but i can't make it to work, maybe because it's a closure function.. i tried naming the whole function and trigger it on window.resize but it didn't work, i probably did some syntax error or misplaced the bit of code. I'm sure it's no difficult task but i can't make it to work :\ can you help?
thank you so much!
 
     
     
    