jquery div 跟隨 滑鼠 移動

來源:互聯網
上載者:User

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh" dir="ltr">

<head>

</head>

<style>

.tuku{ margin:0 auto;}

a{ color:red; text-decoration:none;}

.imgsrc{border:1px solid #cccccc;  background-color:#ffffff; position:absolute;z-index:1000;}

</style>

<script src="jquery.min.js"></script>

<script>

    $(document).ready(function(){

        $("img").mouseover(function(e){

            var xx = e.originalEvent.x || e.originalEvent.layerX || 0;

            var yy = e.originalEvent.y || e.originalEvent.layerY || 0;

            var srcimg = $(this).attr('src');

            $("#alt").attr("src",srcimg);

            $(".imgsrc").css("left",50 + xx + "px");

            $(".imgsrc").css("top",yy + "px");

            $(".imgsrc").css("display","block");

        });

        $("img").mousemove(function(e){

            var xx = e.originalEvent.x || e.originalEvent.layerX || 0;

            var yy = e.originalEvent.y || e.originalEvent.layerY || 0;

            var srcimg = $(this).attr('src');

            $("#alt").attr("src",srcimg);

            $(".imgsrc").css("left",50 + xx + "px");

            $(".imgsrc").css("top",yy + "px");

            $(".imgsrc").css("display","block");

        });

        $("img").mouseout(function(){

            $(".imgsrc").css("display","none");

        });

    });

</script>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<div class="imgsrc" style="display:none"><img src="" id='alt'></div>

<tr>

    <td><table width="" border="0" cellspacing="0" cellpadding="0">

      <tr>

        <td colspan="3">&nbsp;</td>

        </tr>

      <tr>

        <td width="" align="left" valign="middle">&nbsp;</td>

        <!--<td width="" align="left" valign="middle"><label>

          <input type="checkbox" name="fllbqx" id="fllbqx" />

        </label>&nbsp;&nbsp;全選&nbsp;&nbsp;</td>-->

        <td width="" align="left" valign="middle">總計<?php echo $total;?>個記錄

&nbsp;&nbsp;&nbsp;&nbsp;分為<?php echo $total_page;?>頁

&nbsp;&nbsp;&nbsp;&nbsp;當前第<?php echo $page;?>頁

&nbsp;&nbsp;&nbsp;&nbsp;<a href="?m=product&c=product_manage&a=tuku&page=1&product_id=<?php echo $product_id;?>&product_name=<?php echo $product_name;?>&dosubmit=1">第一頁</a>

&nbsp;&nbsp;&nbsp;&nbsp;

<?php if($page-1 > 0){ ?>

<a href="?m=product&c=product_manage&a=tuku&page=<?php echo $page-1;?>&product_id=<?php echo $product_id;?>&product_name=<?php echo $product_name;?>&dosubmit=1">上一頁</a>

<?php }else{echo '上一頁';}?>

&nbsp;&nbsp;&nbsp;&nbsp;

<?php if($page+1 <= $total_page){ ?>

<a href="?m=product&c=product_manage&a=tuku&page=<?php echo $page+1;?>&product_id=<?php echo $product_id;?>&product_name=<?php echo $product_name;?>&dosubmit=1">下一頁</a>

<?php }else{echo '下一頁';}?>

&nbsp;&nbsp;&nbsp;&nbsp;<a href="?m=product&c=product_manage&a=tuku&page=<?php echo $total_page;?>&product_id=<?php echo $product_id;?>&product_name=<?php echo $product_name;?>&dosubmit=1">最末頁</a></td>

      </tr>

    </table></td>

</tr>

<?php } ?>

</body>

</html>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.