Bootstrap Tabs with AJAX snippet - SpDNq5bVl0
2014-07-09 16:23
549 查看
http://www.bootply.com/62742
http://www.bootply.com/63891#
http://www.bootply.com/63891#
$('#myTabs a').click(function (e) { e.preventDefault(); var url = $(this).attr("data-url"); var href = this.hash; var pane = $(this); // ajax load from data-url $(href).load(url,function(result){ pane.tab('show'); }); }); // load first tab content $('#home').load($('.active a').attr("data-url"),function(result){ $('.active a').tab('show'); });
<div class="container-fluid"> <ul class="nav nav-tabs" id="myTabs"> <li class="active"><a href="#home" data-url="/embed/62805/view">Home</a></li> <li><a href="#profile" data-url="/embed/62806/view">Profile</a></li> <li><a href="#messages" data-url="/embed/62807/view">Messages</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="home">This is the home pane...</div> <div class="tab-pane" id="profile"></div> <div class="tab-pane" id="messages"></div> </div> </div>
$('#myCarousel').carousel({ interval:false // remove interval for manual sliding }); // when the carousel slides, load the ajax content $('#myCarousel').on('slid', function (e) { // get index of currently active item var idx = $('#myCarousel .item.active').index(); var url = $('.item.active').data('url'); // ajax load from data-url $('.item').html("wait..."); $('.item').load(url,function(result){ $('#myCarousel').carousel(idx); }); }); // load first slide $('[data-slide-number=0]').load($('[data-slide-number=0]').data('url'),function(result){ $('#myCarousel').carousel(0); });
<div class="container"> <h2>Bootstrap Carousel AJAX Content</h2> <div class="span5"> <div id="myCarousel" class="carousel"> <div class="carousel-inner"> <div class="active item" data-url="/render/62805" data-slide-number="0"> </div> <div class="item" data-url="/render/62806"> </div> <div class="item" data-url="/render/62807"> </div> </div> <a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a> <a class="carousel-control right" href="#myCarousel" data-slide="next">›</a> </div> </div> </div>
相关文章推荐
- Bootstrap tab选项卡实现AJAX加载不同的JSP页面的方法
- 使用ajax制作的tab
- How to create a site with AJAX enabled in MVC framework.
- 如何写一个前端组件-以bootstrap-tab为例
- Preloading Data with Ajax and JSON
- Foundations of Atlas: Rapid Ajax Development with ASP.NET 2.0
- Javascript and AJAX with Yii(在yii 中使用 javascript 和ajax)
- 17个使用AJAX技术的数据表格控件解决方案(Data Grids with AJAX, DHTML and JavaScript)
- Bootstrap的js插件之标签页(tab)
- AngularJS ui.bootstrap.tabs
- highchart在bootstrap的Tab组件下容器问题
- 从jQuery的ajax请求中删除X-Requested-With
- PHP判断ajax请求:HTTP_X_REQUESTED_WITH
- resizableImageWithCapInsets实现登录按钮、胶囊tab按钮和聊天气泡贴图效果
- Ajax TabContainer
- bootstrap开发tab选项卡事例
- PHP判断ajax请求:HTTP_X_REQUESTED_WITH
- 6.3.4. Increasing Responsiveness with Ajax ('It's Too Slow!')
- How do you do a JQuery Ajax Loading Div complete with loading
- bootstrap中tab切换angular绑定失效