【问题标题】:asp.net make function from jquery code来自 jquery 代码的 asp.net make 函数
【发布时间】:2012-06-21 11:56:53
【问题描述】:

我正在为我的工具提示使用 Qtip jquery 插件,因为我有很多需要此插件的项目,所以我不想为每个项目手动执行此操作,反正编码不好。

这是JS代码:

$('#<%= textlink.ClientID %>').qtip({               
    position: { 
          corner: {
                      target: 'topRight', 
                      tooltip: 'bottomLeft'
            }
              },                                    
        style:{ 
            name: 'dark',
            tip: 'bottomLeft',
            border:
              {
            width: 3,
            radius: 7
        }
    } 
});

<asp:LinkButton ID="textlink" runat="server" Text="some text" ToolTip="some other text"></asp:LinkButton>

我将有很多链接按钮对象,那么如何从上面的 JS 代码中创建一个函数并在鼠标悬停链接按钮操作时调用它?

【问题讨论】:

    标签: c# javascript jquery asp.net qtip


    【解决方案1】:

    这样做:

    <asp:LinkButton cssClass="qTip" ID="textlink" runat="server" Text="some text" ToolTip="some other text"></asp:LinkButton>
    
    $('.qTip').qtip({               
        position: { 
              corner: {
                          target: 'topRight', 
                          tooltip: 'bottomLeft'
                }
                  },                                    
            style:{ 
                name: 'dark',
                tip: 'bottomLeft',
                border:
                  {
                width: 3,
                radius: 7
            }
        } 
    });
    

    【讨论】:

      【解决方案2】:

      LinkButton 上放置一个类并在您的 jQuery 中使用类选择器

      <asp:LinkButton ID="textlink" cssClass="qtip" runat="server" Text="some text" ToolTip="some other text"></asp:LinkButton>
      
      $('.qtip').qtip({               
          //...
      });
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-10-17
        • 1970-01-01
        • 1970-01-01
        • 2016-02-29
        • 1970-01-01
        相关资源
        最近更新 更多