Solved

mouseout is not working as expected

Posted on 2014-12-13
1
92 Views
Last Modified: 2014-12-14
I'm dynamically generating a list of checkboxes, I want this to dissapear as soon as I mouse out, but it dissapears
when I move my mouse out of Fldsbutt

<div class="container" id = "container"> 
        <div class="form-group">         
                <label for="selfile" class="col-sm-2 control-label">  Select File </label>  
                        
                <?php
                
                    $options = generate_files();
                    echo '<select id="selfile" name="selfile">'.$options.'</select>';                    	        
                ?>
              
        </div>
       
       
          <div class="form-group"  id="fieldsdiv" >         
              <label for="selfile" class="col-sm-2 control-label">  Fields </label> 

        	
        	 			   
        	    <button id="Fldsbutt"  class = "multiSelect ui-widget sd ca"  type="button"  tabindex = "0" style="width:225px;">
        	    
            	     <span class="ui-icon ui-icon-triangle-2-n-s"></span>
            	     <span id="Pstext" class= "ui-text"> </span>
            	     
        	     </button>    <span id="pleaseWait"> </span>
        	     
            	    <div id="selfields" class="multiSelectOptions">
            	    	    
            	    </div> 	
        	     	
        	    <span id="Pss">     </span> 		 		   		 		
             </div>		  	  	 	 	  	 	  		 		  	  										
 	 
          
        
              
          
       
            
                         
    
            
      </div>      
   
   <script>


   
   var base_url = '<?php echo site_url() ?>';
   var controller = 'gen';
   var method = 'mixed';

    $(function() {	
	   $('#selfile'). change(function() {
			 
		   var $file = $('#selfile').val();
		      		      
		      if($file !== undefined)
		      {
		    		
		    	     var	 $path = $file;    
  		    	        		    	   	    	    			     
  		    	 $.ajax({							
  						url: base_url+'/'+ controller +'/' + method,
  						type: "POST",
  						data: {
  							file: $path,
  							},
  						success: function(ret_data) {
      						if (ret_data != 'error')
      						{	
      							$('#pleaseWait').html('Click the arrow to select fields');
      						    $('#selfields').html(ret_data);
      						    $('#selfields').hide();
      					     } 

      						else  	$('#pleaseWait').html('');
  						}			
  						}); 
		      }	    });
		
		
		$('#selfields').mouseout(function() {
			    console.log('mouseout');
			    $('#selfields').hide();
							

			});
		    	    

		$('#Fldsbutt'). click(function() {
	 
		    $('#selfields').show();
		    
		   });  		
		});	
		
	       
  </script> 
  
 </body>
 </html>  

Open in new window

0
Comment
Question by:sniger
1 Comment
 
LVL 30

Accepted Solution

by:
Alexandre Simões earned 500 total points
ID: 40498865
For me it works perfectly.

I think probably you're forgetting that selfields is a div and is using the whole width.
So even if you're entering an area that looks like it doesn't belong to it, chances are that it is.

Just to make sure try setting a border for that div to have a visual reference o fit's boundaries:
.multiSelectOptions{border: solid 1px #000;}

Open in new window


Here's the fiddle that I used to test: http://jsfiddle.net/AlexCode/o7vuko5t/
Looks bad, and I disabled all the dynamic stuff, but it's enough to test the scenario.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to check if a session is disconnected in php 9 31
Load data upon clicking a button 8 33
PHP and JQuery Syntax question 4 26
Insert Button on a table 16 36
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question