日期:2014-05-16 浏览次数:20370 次
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script src="js/jquery.min.js" type="text/javascript"></script> <script src="js/jquery.hoverIntent.minified.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { function megaHoverOver() { $(this).find(".sub").stop().fadeTo('fast', 1).show(); //Calculate width of all ul's (function($) { jQuery.fn.calcSubWidth = function() { rowWidth = 0; //Calculate row $(this).find("ul").each(function() { rowWidth += $(this).width(); }); }; })(jQuery); if ($(this).find(".row").length > 0) { //If row exists... var biggestRow = 0; //Calculate each row $(this).find(".row").each(function() { $(this).calcSubWidth(); //Find biggest row if (rowWidth > biggestRow) { biggestRow = rowWidth; } }); //Set width $(this).find(".sub").css({ 'width': biggestRow }); $(this).find(".row:last").css({ 'margin': '0' }); } else { //If row does not exist... $(this).calcSubWidth(); //Set Width $(this).find(".sub").css({ 'width': rowWidth }); } } function megaHoverOut() { $(this).find(".sub").stop().fadeTo('fast', 0, function() { $(this).hide(); }); } var config = { sensitivity: 2, // number = sensitivity threshold (must be 1 or higher) interval: 100, // number = milliseconds for onMouseOver polling interval over: megaHoverOver, // function = onMouseOver callback (REQUIRED) timeout: 500, // number = milliseconds delay before onMouseOut out: megaHoverOut // function = onMouseOut callback (REQUIRED) }; $("ul#topnav li .sub").css({ 'opacity': '0' }); $("ul#topnav li").hoverIntent(config); }); </script>
<!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> <title>点击弹出下拉列表效果,sky整理收集。</title> <style type="text/css"> body{ margin:10px; padding:10px; } body,td,div,span,li{ font-size:12px; } .title01,.title02{ color:#fff; font-weight:bold; } #DoorP{ border:12px solid #eee; width:150px; height:300px; padding:4px; background:#fff; } .title01{ width:100%; height:25px; background:#00ccff; cursor:pointer; } .title02{ width:100%; height:25px; background:#99cc00; cursor:pointer; } .content{ background:#eee; border-bottom:2px solid #fff; overflow:hidden; col