You are here

Javascript image dropdown - basic in Language Switcher Dropdown 7

Documentation
 
  • child widtth can be alter.
  • New multiple is introduced. Its multiple but with the checkbox.
  • Bonus: elementname_mscheck will be posted along with the form post/get. i.e. if element name is "tech" checkbox tech_mscheck[] is created. However you can set the suffix using 'checkboxNameSuffix' parameter. Submit to check the result.
 
 
 
Source Code:
<script>
$(document).ready(function(e) {
	$("#tech").msDropdown({childWidth:"250px",enableCheckbox:true});
    //element's data-enablecheckbox="true" can also work for checkbox enabled dropdown. and data-childwidth can be used for seting child width
});
</script>    
 
 

 

File

msdropdown/examples/use-checkbox.html
View source
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Javascript image dropdown - basic</title>
<link rel="stylesheet" href="css/sample.css" />
<script src="../js/jquery/jquery-1.9.0.min.js"></script>
<!-- <msdropdown> -->
<link rel="stylesheet" type="text/css" href="../css/msdropdown/dd.css" />
<script src="../js/msdropdown/jquery.dd.min.js"></script>
<!-- </msdropdown> -->
</head>
<body>
<table width="100%" border="0" cellspacing="1" cellpadding="5" class="topmenu">
  <tr>
    <td colspan="2" class="top"><h1>Javascript image dropdown <span id="ver"></span> <a title="Download" href="http://www.marghoobsuleman.com/jquery-image-dropdown" class="small">Download</a></h1></td>
  </tr>
  <tr>
    <td width="25%"><select style="width:250px"  name="pages" id="pages">
      <option value="" selected="selected">Choose a sample page</option>
      <option value="index.html">Normal</option>
      <option value="byjson.html">By Json Data</option>
      <option value="multiple-skin.html">Multiple Skin</option>
      <option value="css-sprite.html">CSS Sprite</option>
      <option value="object-oriented-approach.html">Object Oriented Approach</option>
      <option value="object-oriented-approach-more.html">Object Oriented Approach - More</option>
      <option value="use-checkbox.html">Use Checkbox</option>
      <option value="mouse-events.html">Mouse Events</option>
      <option value="help.html">Documentation</option>
    </select></td>
    <td align="left"><a href="help.html">Documentation</a></td>
  </tr>
</table>
<form action="submitdata.php" method="post" enctype="multipart/form-data" name="frmdata">
<table width="100%" border="0" cellspacing="1" cellpadding="5" class="tblWhite">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td valign="top"><select style="width:150px" class="tech" name="tech" id="tech" data-enablecheckbox="true">
      <option value="calendar">Calendar</option>
      <option value="shopping_cart">Shopping Cart</option>
      <option value="cd" name="cd">CD</option>
      <option value="email">Email</option>
      <option value="faq">FAQ</option>
      <option value="games">Games</option>
      <option value="music">Music</option>
      <option value="phone">Phone</option>
      <option value="graph">Graph</option>
      <option value="secured">Secured</option>
      <option value="video">Video</option>
    </select></td>
  </tr>
  <tr>
    <td valign="top"><ul>
      <li>child widtth can be alter. </li>
      <li>New multiple is introduced. Its multiple but with the checkbox.</li>
      <li><strong>Bonus:</strong> elementname<strong>_mscheck</strong> will be posted along with the form post/get. i.e. if element name is &quot;tech&quot; checkbox <strong>tech_mscheck[]</strong> is created. However you can set the suffix using 'checkboxNameSuffix' parameter. Submit to check the result. </li>
    </ul></td>
  </tr>
  <tr>
    <td valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td valign="bottom">&nbsp;</td>
  </tr>
  <tr>
    <td valign="bottom"><input type="submit" value="Submit" /></td>
  </tr>
  <tr>
    <td valign="bottom">&nbsp;</td>
  </tr>
  <tr>
    <td valign="bottom"><strong>Source Code:</strong></td>
  </tr>
  <tr>
    <td valign="top">
      
  <code>
  <pre>
&lt;script>
$(document).ready(function(e) {
	$("#tech").msDropdown({childWidth:"250px",enableCheckbox:true});
    //element's data-enablecheckbox="true" can also work for checkbox enabled dropdown. and data-childwidth can be used for seting child width
});
&lt;/script>    
</pre>
  </code>    
      </td>
  </tr>
  <tr>
    <td valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top">&nbsp;</td>
  </tr>
</table>
</form>
<p>&nbsp;</p>

<script>
$(document).ready(function(e) {
	$("#tech").msDropdown({childWidth:"250px", enableCheckbox:true});
//no use
	try {
		var pages = $("#pages").msDropdown({on:{change:function(data, ui) {
												var val = data.value;
												if(val!="")
													window.location = val;
											}}}).data("dd");

		var pagename = document.location.pathname.toString();
		pagename = pagename.split("/");
		pages.setIndexByValue(pagename[pagename.length-1]);
		$("#ver").html(msBeautify.version.msDropdown);
	} catch(e) {
		//console.log(e);	
	}
	
	$("#ver").html(msBeautify.version.msDropdown);
});
</script>

</body>
</html>