Window Resize: Applying a Custom Function

Window Resize: Applying a Custom Function

I have developed a responsive site and am trying to apply a variable that is set on window resize if  a screen resolution that is lower than 1500px. Am fairly new to jquery.

Here is my resize script. I am working on just one button to start with:


So if the screen is lower than 1500px the variable is 61% and if the screen is higher then the variable is 50.6666%.

This is so I can have panel slides in from the side. The panel has a variable width depending on the screen res therefore the scroll amount needs to change depending on how wide the screen is.

I have tried this on one button but I get a div that slides in and out multiple times. 


Help appreciated.