Solved

mouseout is not working as expected

Posted on 2014-12-13
1
89 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
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)

911 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now