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>
  • 相关阅读:
    离开学校一年多
    ZOJ Problem Set–1337 Pi
    Old Bill
    ZOJ Problem Set–1382 A Simple Task
    ZOJ Problem Set 2975 Kinds of Fuwas
    ZOJ Problem Set 2952 Find All M^N Please
    Generate Passwords
    Java 数据类型转换之字符串
    ZOJ Problem Set 2987 Misspelling
    Digital Roots
  • 原文地址:https://www.cnblogs.com/xweiwei/p/2757113.html
Copyright © 2011-2022 走看看