Skip to content

module_isOnScreen

Wesley De Groot edited this page Oct 15, 2015 · 4 revisions
            	     _    _____ 
        	        | |  / ____|
    	            | |  | (___  
	            _   | |  \___  \ 
 ______    _   | |__| |  ____) |
|______|  (_)   \____/  |______/ 

Module: isOnScreen

Check if object is still on screen, we got 3 options!


Call a function!
<script type="text/javascript">
  _().require("_isonscreen", function(){ 
  
    // Call function when changed
    _('.wrapper').isOnScreen(
    	function(){
    		console.log('on Screen');
    	},
    	function(){
    		console.log('Terrible, i\'m Lost!')
    	}); 
  });
</script>

Set Class

Please Don't forget the . on the beginning to say that you set a class

<script type="text/javascript">
  _().require("_isonscreen", function(){ 
  
    // Change class when changed
    _('.wrapper').isOnScreen(
    	'.classOnScreen', 
    	'.classOffScreen'
    ); 
  });
</script>

Set Style
<script type="text/javascript">
  _().require("_isonscreen", function(){ 
  
    // Change style when changed
    _('.wrapper').isOnScreen(
    	'background: red;', 
    	'background: green;'
    ); 
  });
</script>
Clone this wiki locally