zoukankan      html  css  js  c++  java
  • 【jQuery】Hello,jQuery

    最近看一些jQuery的东西,最最简单的例子了,记录下。

    这个例子是用来替代浏览器自带的超链接提示效果(即a标签的title属性),可以实现随鼠标移动。 

    大体思路就是控制mouseover,mouseout,mousemove几个事件,完整代码如下(运行需要jQuery):

    <head>
    <script src="./jquery-1.8.2.min.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    $(document).ready(function(){
        $("a.tooltip").mouseover(function(e){
            var tooltip="<div id='tips'>heihei</div>";
            $("body").append(tooltip);
            $("#tips")
                .css({
                "color":"red",
                "margin-top":e.pageY+"px",
                "margin-left":e.pageX+"px"}).show("fast");
        }).mouseout(function(){
            $("#tips").remove();
        }).mousemove(function(e){
            $("#tips")
                .css({
                "margin-top":(e.pageY)+"px",
                "margin-left":(e.pageX)+"px"}).show("fast");    
        });
    });
    </script>
    </head>

    <body>
    <p><href="#" class="tooltip">提示</a></p>
    </body>
  • 相关阅读:
    14.3 Go iris
    14.2 Go性能优化
    14.1 Go数据结构
    13.3 Go章节练习题
    13.2 Go练习题答案
    13.1 Go练习题
    12.1 Go nsq
    11.3 Go 开发博客
    11.2Go gin
    11.1 Go Http
  • 原文地址:https://www.cnblogs.com/xweiwei/p/2757113.html
Copyright © 2011-2022 走看看