javascript - Determine a reverse value based on a range -


i have html page css animation 'pushing' main container of page right 100px when left-hand nav menu hovered over.

however, menu needs pushed in decrementally less pixel amounts window size increases.

at browser window size of 790px wide (or less), container's left position 59px (retrieved using jquery's $.offset().left, , needs pushed full 100px make menu visible.

however, browser window size increases between 790px , 1039px, menu needs pushed less , less - time window size 1039px/container's left position 184px, push needs 1px.

so window size range working is:

1039 - 790 = 249px 

the position range of container adjusts in window sizes to:

183 (when window size 1039) - 59 (when window size 790) = 124px 

i want push menu this:

min container position: left 59px = 100px push max container position: left 183px = 1px push 

and between 1px , 100px values between the min , max container position.

how can assign push value of 100px when window size 790px/or container's left position 59px, , assign decreasing range of push values when window size/left position increases?

jsfiddle: https://jsfiddle.net/jazzbangle/5mn3y29k/4/


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -