鼠标悬停时显示 jQuery 弹出窗口

发布于 2024-12-23 12:14:07 字数 1659 浏览 3 评论 0原文

在 ASPX 页面中,我希望在鼠标悬停完成的位置的关闭 xy 坐标内显示弹出窗口(类似于 Windows 状态栏,当我们将鼠标悬停在 Outlook 上时,它会在旁边显示一些内容。)

所以在我的 ASPX 页面中,目前我有jquery 在页面中央显示对话框(它将 ASPX 页面屏蔽为全白,然后将实际内容显示为弹出窗口),但我想显示更靠近鼠标悬停的弹出窗口,而不屏蔽aspx 页面。

ASPX 页面很少有 jquery 参考。 下面是 ASPX 页面。

<asp:Content ContentPlaceHolderID="PageScript" runat="server">
    <div class="inline">
        <a href="#" tabindex="-1" class="question-quality"></a>
        <span>Quality:</span>
    </div>

<div id="dialog_product-quality" class="dialog-content" style="display: none;">
    <div class="dialog-content-padding">
        <p>
             <asp:Literal runat="server" ID="ProductQualityContentText" />
        </p>
    </div>
</div>

<link type="text/css" href="/store/javascript/css/jquery.ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="/javascript/jquery.ui.core.js"></script>
<script type="text/javascript" src="/javascript/jquery.ui.widget.js"></script>
<script type="text/javascript" src="/javascript/jquery.ui.mouse.js"></script>
<script type="text/javascript" src="/javascript/jquery.ui.slider.js"></script>
<script type="text/javascript" src="/javascript/jquery151.min.js"></script>
<script type="text/javascript">

$(document).ready(function() {
$('div#dialog_product-quality').dialog(dialog_options);

$('a.Quality').hover(function(e){
   e.preventDefault();
   openDialogWindow('div#dialog_product-quality', 'Product Quality');
});
</script>
</asp:Content>

请建议。

谢谢。

Within an ASPX page, I would like to have the popup shown within the closes xy coordinate of where mousehover is done (similar to windows status bar where when we mousehover outlook it shows something next to it. )

So in my ASPX page currently I have the jquery that shows the dialog in the center of the page (it masks the ASPX page into whole white and then displays the the actual content as a popup window) but I would like to show the popup closer to the mousehover without masking the aspx page.

The ASPX page has few jquery references.
Below is the ASPX page.

<asp:Content ContentPlaceHolderID="PageScript" runat="server">
    <div class="inline">
        <a href="#" tabindex="-1" class="question-quality"></a>
        <span>Quality:</span>
    </div>

<div id="dialog_product-quality" class="dialog-content" style="display: none;">
    <div class="dialog-content-padding">
        <p>
             <asp:Literal runat="server" ID="ProductQualityContentText" />
        </p>
    </div>
</div>

<link type="text/css" href="/store/javascript/css/jquery.ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="/javascript/jquery.ui.core.js"></script>
<script type="text/javascript" src="/javascript/jquery.ui.widget.js"></script>
<script type="text/javascript" src="/javascript/jquery.ui.mouse.js"></script>
<script type="text/javascript" src="/javascript/jquery.ui.slider.js"></script>
<script type="text/javascript" src="/javascript/jquery151.min.js"></script>
<script type="text/javascript">

$(document).ready(function() {
$('div#dialog_product-quality').dialog(dialog_options);

$('a.Quality').hover(function(e){
   e.preventDefault();
   openDialogWindow('div#dialog_product-quality', 'Product Quality');
});
</script>
</asp:Content>

Please suggest.

thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

客…行舟 2024-12-30 12:14:07

引用OP:

...我希望在关闭 xy 坐标内显示弹出窗口
鼠标悬停完成的位置...

...ASPX 页面很少引用 jquery...

...请提出建议。

jQuery 插件 qTip2 将为您提供让弹出工具提示或模式框跟随鼠标指针的选项(如果这是您所要求的)。请参阅下面的鼠标跟踪演示。

http://craigsworks.com/projects/qtip2/demos/#mouse

jsFiddle 演示与代码

下载并包含 qTip2 JavaScript 和CSS 文件。

<div id="demo-mouse" class="box">
    <h3>Hover over this box to see mouse tracking in action</h3>
</div>


$(document).ready(function()
{
    $('#demo-mouse').qtip({
        content: 'I position myself at the current mouse position',
        position: {
            my: 'top left',
            target: 'mouse',
            viewport: $(window), // Keep it on-screen at all times if possible
            adjust: {
                x: 10,  y: 10
            }
        },
        hide: {
            fixed: true // Helps to prevent the tooltip from hiding ocassionally when tracking!
        },
        style: 'ui-tooltip-shadow'
    });
});

Quote OP:

...I would like to have the popup shown within the closes xy coordinate
of where mousehover is done...

...The ASPX page has few jquery references...

...Please suggest.

jQuery plugin, qTip2, will give you the option of having the popup tooltip or modal box follow the mouse pointer, if that's what you're asking. See mouse tracking demo below.

http://craigsworks.com/projects/qtip2/demos/#mouse

jsFiddle Demo with Code

Download and include the qTip2 JavaScript & CSS files.

<div id="demo-mouse" class="box">
    <h3>Hover over this box to see mouse tracking in action</h3>
</div>


$(document).ready(function()
{
    $('#demo-mouse').qtip({
        content: 'I position myself at the current mouse position',
        position: {
            my: 'top left',
            target: 'mouse',
            viewport: $(window), // Keep it on-screen at all times if possible
            adjust: {
                x: 10,  y: 10
            }
        },
        hide: {
            fixed: true // Helps to prevent the tooltip from hiding ocassionally when tracking!
        },
        style: 'ui-tooltip-shadow'
    });
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文