zoukankan      html  css  js  c++  java
  • 鼠标滑至某位置,在鼠标旁边出现详情弹窗div

    首先效果如下:

    代码如下:

    //这个是一个循环,循环所有name为xx的td标签(也就是给tdname为XXX的添加事件)
    $("td[name='strGoodsSKU']").each(function(index,item){ var oldTest = $(this).text();
    //如果td里的text长度大于了30个字符的话,后面的字符替换成。。。
    if($(this).text().length>30){ var newText = $(this).text().substring(0,30); $(this).text(newText+"..."); } //开始添加鼠标滑过事件,传递两个function,function1为滑进事件,function2为滑出事件 $(this).hover( function () {  //添加一个div,给div设置样式,并且显示到鼠标的旁边 $(document.body) .append($('<div id="follower" style="500px;height:80px;border:1px solid #000;background:#e1e1e1;position:absolute"></div>')) .mousemove(function(e){ $("#follower").text(oldTest).css({top:e.pageY+10,left:e.pageX+10}) }) },function(){
                //移除显示div $(
    "#follower").remove(); }); /* $(this).mouseleave( function () { }); */ });
  • 相关阅读:
    B.Little Sub and Triples
    A.Little Sub and Applese
    1003 超级无敌简单题[暴力打表]
    1002 人类史上最大最好的希望事件[前缀和]
    1001 hzy 和zsl 的生存挑战
    Computer Arrangement [经典贪心]
    Linux指令
    LInux
    Servlet
    El表达式与JSTL表达式
  • 原文地址:https://www.cnblogs.com/weiloong/p/4958527.html
Copyright © 2011-2022 走看看