0

I want to edit the css of a div element during .resize() event and after the resize event revert to the default css properties.

To add context: Say I want set display:none; to a fullscreen image gallery while I resize the browser window. But after I stopped resizing (timeout?) fade the content back in.

Or toggle class on resize.

Hope you'll understand! Best regards

1 Answer 1

1
timer = 0;
function start() {
    $("#id").addClass("resizing");
}
function stop() {
    $("#id").removeClass("resizing");
}
$(window).resize(function(){
    if (timer) {
        clearTimeout(timer);
    }
    timer = setTimeout(stop, 1000);
    start();
});
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.