C# 如何在jQuery accordion上使用jQuery工具提示
有人能告诉我如何在jQuery手风琴控件上使用jQuery工具提示吗C# 如何在jQuery accordion上使用jQuery工具提示,c#,jquery,tooltip,accordion,C#,Jquery,Tooltip,Accordion,有人能告诉我如何在jQuery手风琴控件上使用jQuery工具提示吗 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="serv
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="Scripts/jquery-1.10.2.js"></script>
<script type="text/javascript" src="Scripts/jquery-ui-1.10.3.custom.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#Accord').accordion(
{
create: function (event, ui) {
$('.ui-accordion-header').attr("disabled", true);
}
});
})
$(document).tooltip();
</script>
</head>
<body>
<form id="form1" runat="server">
<div class="row" id="Accord">
<h2>Getting started</h2>
<div class="col-md-4">
<p>
ASP.NET Web Forms lets you build dynamic websites using a familiar drag-and-drop, event-driven model.
A design surface and hundreds of controls and components let you rapidly build sophisticated, powerful UI-driven sites with data access.
</p>
<p>
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301948">Learn more »</a>
</p>
</div>
<h2>Get more libraries</h2>
<div class="col-md-4">
<p>
NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.
</p>
<p>
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301949">Learn more »</a>
</p>
</div>
<h2>Web Hosting</h2>
<div class="col-md-4">
<p>
You can easily find a web hosting company that offers the right mix of features and price for your applications.
</p>
<p>
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301950">Learn more »</a>
</p>
</div>
</div>
</form>
</body>
</html>
$(文档).ready(函数(){
$('#Accord')。手风琴(
{
创建:函数(事件、用户界面){
$('.ui accordion header').attr(“disabled”,true);
}
});
})
$(document.tooltip();
开始
ASP.NET Web窗体允许您使用熟悉的拖放、事件驱动模型构建动态网站。
一个设计图面和数百个控件和组件使您能够快速构建复杂、功能强大的用户界面驱动的站点,并提供数据访问。
获取更多库
NuGet是一个免费的VisualStudio扩展,可以轻松地在VisualStudio项目中添加、删除和更新库和工具。
网络托管
您可以很容易地找到一家为您的应用程序提供正确的功能和价格组合的web托管公司。
上面是我的示例代码。请指导我如何将工具提示与手风琴集成?我想用鼠标悬停在accordion的标题上,获得面板的某些内容。无需使用任何插件。你自己写就行了。 您可以将要显示的内容悬停在自定义属性(或例如
rel
属性)中,然后获取其值并在jquery生成的绝对位置范围内显示
例如:
HTML:
<h2 rel="YOUR CONTENT GOES HERE">Web Hosting</h2>
$(function(){
var ttContent = $('h2').attr('rel');
$('h2').hover(function(){
$(this).append('<span class="ttbox">' + ttContent + '</span>');
},function(){
$(this).children('.ttbox').remove();
});
});
h2 { position:relative; }
.ttbox { position:absolute; display:none; top:20px; width:200px; height:30px; display:block; background:#000; color:#fff; }
顺便说一句,它叫jQuery.nice suggestion。当标题被禁用时,我可以在手风琴面板上使用相同的东西吗?我还需要显示来自各个内容面板的数据,这可能吗?是的,您可以在任何地方这样做。“各自的内容”是指希望jquery自动获取内容的一部分并将其放入工具提示框中?每个accordion标题都有一个相关的面板。我指的是内容面板中的数据。你能给出一个例子或演示代码吗?谢谢。这正是我要找的。最后一件事。我在accordion中转换了您的jsfiddle代码并禁用了头,然后它就不起作用了。知道吗?你能给我一把小提琴吗?我应该检查你的手风琴css和jquery代码之间的冲突。