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 () { }); */ });
  • 相关阅读:
    python
    weui 问题
    Mac 问题
    ORM存储过程和实体类代码生成工具
    说说QQ空间SEO
    用户体验走嘴和走心的区别
    一切不以用户为中心的O2O 都是耍流氓
    10分钟制作自己的手机QQ
    一无所有其实没什么
    别人的鞋不一定合脚
  • 原文地址:https://www.cnblogs.com/weiloong/p/4958527.html
Copyright © 2011-2022 走看看