n0xx
n0xx

Reputation: 11

Refresh div after window resize

im building responsive layout site and eveything is going great except one plugin. Plugin is ulslide (lightweight gallery)

width of parent is:    
width:calc(100% - 330px);

width of div where plugin is:
width:100%;

-330px = panel on the right side

Everything is scalling great except this one div - it's scaling but after site refresh... Is possible to refresh via jquery div after window size and orientation change ? If not is it possible to change width of this object "in fly" when the window size change ?

I searched for similar thing but all answers was about whole site refresh which i dont want to use.

I could use:

@media only screen and (max-width: XXXpx){
}

But that's going to be the last thing i want.

Upvotes: 0

Views: 5858

Answers (2)

j3r6me
j3r6me

Reputation: 808

With jQuery you can execute any code you want when the resize event is triggered using this piece of code:

$( window ).resize(function() {

});

In the function content you can play with your div width doing something like that:

$('#yourDivID').width(100);

Upvotes: 1

MrMilbury
MrMilbury

Reputation: 36

Have you tried this?

$( window ).resize(function() {
     your function
});

For detail: https://api.jquery.com/resize/

Upvotes: 1

Related Questions