Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
Results 1 to 1 of 1
-
03-07-2016, 06:43 PM #1New to the CF scene
- Join Date
- Mar 2016
- Posts
- 1
- Thanks
- 0
- Thanked 0 Times in 0 Posts
How to stop a function for a certain element under a certain condition
I'm working on a small portfolio website and at the moment I'm at the stage of sorting the breaking points/media queries. Very quickly I realized the in order to achieve that, I need to stop some JS functions from keep happening at a certain screen width.
I basically designed the website so each section will take the full height of the window and the side bar takes 2x the height. I want the side bar to stop that function and change other function like slide and pin at 1240px width.
https://github.com/Mooli88/portfolio The full code can be found under /components/script
I've tried numerous solutions that I found here and on google but always got stuck with something else (i.e the function stops but is not coming back when needed).Code:function fullheight(selector, tims) { var winheight = $(window).height(); var sidenavLimit = winwidth < 1240; $(selector).css('height', winheight * tims); $(window).resize(function() { var winheight = $(window).height(); $(selector).css('height', winheight * tims); }) //resize } //fullheight fullheight('.fullheight', 1); fullheight('.fullheightMid', 1.3); fullheight('.side_nav', 2);



Reply With Quote
