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>
  • 相关阅读:
    Insert Buffering
    B-Tree vs LSM-tree
    MySQL 5.6 死锁演示 及 日志分析
    MySQL索引
    InnoDB的三个关键特性
    MySQL如何优化GROUP BY :松散索引扫描 VS 紧凑索引扫描
    MySql 自适应哈希索引
    母牛的故事
    简单的java程序
    一些变量的比较
  • 原文地址:https://www.cnblogs.com/xweiwei/p/2757113.html
Copyright © 2011-2022 走看看