jquery 中mouseover,click,toggle用法

    xiaoxiao2021-11-28  52

    hover:鼠标悬停/离开切换事件 hide: 隐藏 show: 显示 <!doctype html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <meta name="Generator" content="EditPlus®"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <title>jquery层</title> </head> <body> <div name="mydiv" id="mydiv" style="position:absolute;left:200px;top:200px;height:200px;width:200px"> <input name="xuanzhe" id="xuanzhe" type="button" value="选择鼠标" ><br> </br> <input type="text" id="js" value="javaScript"><br> </div> <script type="text/JavaScript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script> <script type="text/javascript"> $(function(){ $("#xuanze").mouseover(function(){ alert("按钮被选择"); // var width=$("#xuanze").width(); // var height=$("#xuanze").height(); // alert("层的宽:"+width+"px"+"层的高:"+height+"px"); }); }); $(function(){ $("#xuanzhe").click(function(){ $("#js").hide(); }, function(){ $("#js").show(); } ); }); </script> </body> </html>
    转载请注明原文地址: https://ju.6miu.com/read-678571.html

    最新回复(0)