论坛首页 Web前端技术论坛

jQuery模仿ExtJS之TabPanel

浏览 84978 次
该帖已经被评为良好帖
作者 正文
   发表时间:2010-03-12  
怎么有点觉得这个东西是用了 EXTJS本身的类库,如 Tab用法也和EXTJS一样。LZ是不是用JQUERY调用EXTJS中的类库。
0 请登录后投票
   发表时间:2010-03-12  
LookAtPic 写道
怎么有点觉得这个东西是用了 EXTJS本身的类库,如 Tab用法也和EXTJS一样。LZ是不是用JQUERY调用EXTJS中的类库。

你看一下代码不就知道了吗。呵呵
0 请登录后投票
   发表时间:2010-03-26  
楼主,请问下打开一个选项卡的时候 怎样吧打开的页面设为焦点啊? 或者点击选项卡上的标题的时候也是那页面的焦点啊?
0 请登录后投票
   发表时间:2010-03-29  
$(function(){
  var tabPanel;
//初始化默认加载第一个页签
  tabs('tab',0,'<iframe src="工作中心.html" width="100%" height="100%" frameborder="0"></iframe>','');
function tabs(divId,activenum,content,content1){
  tabPanel = new TabPanel({
  renderTo:divId,
  width: '100%',
  height: '100%',
  active: activenum,
  items: [{
    id:'workid',
    title:'工作中心',
    html:content,
    closable: false
  }],[{
   id:'userid',
    title:'用户中心',
    html:content1,
    closable: false
  }]
 });
}
});

//给用户中心页签添加click事件
$(#userid).click(function(){
  tabs('tab',1,'','<iframe src="用户中心.html" width="100%" height="100%" frameborder="0"></iframe>');
});


我的需求就是不加载所有的页签页面,根据点击某一个页签而加载相关的页签内容。
问题:初始化默认加载第一个页签可以成功加载,点击用户中心页签,该页签内容不显示了。
0 请登录后投票
   发表时间:2010-03-29   最后修改:2010-03-29
nell_zn82 写道
$(function(){
  var tabPanel;
//初始化默认加载第一个页签
  tabs('tab',0,'<iframe src="工作中心.html" width="100%" height="100%" frameborder="0"></iframe>','');
function tabs(divId,activenum,content,content1){
  tabPanel = new TabPanel({
  renderTo:divId,
  width: '100%',
  height: '100%',
  active: activenum,
  items: [{
    id:'workid',
    title:'工作中心',
    html:content,
    closable: false
  }],[{
   id:'userid',
    title:'用户中心',
    html:content1,
    closable: false
  }]
 });
}
});

//给用户中心页签添加click事件
$(#userid).click(function(){
  tabs('tab',1,'','<iframe src="用户中心.html" width="100%" height="100%" frameborder="0"></iframe>');
});


我的需求就是不加载所有的页签页面,根据点击某一个页签而加载相关的页签内容。
问题:初始化默认加载第一个页签可以成功加载,点击用户中心页签,该页签内容不显示了。


给需要延迟加载的item增加 lazyload : true 属性。
{
          title:'数据范围',
          html:'<iframe id="users" name="users" src="xxx" width="100%" height="100%" frameborder="0"></iframe>',
          closable : false,
          lazyload : true,
          icon:'../../image/icon/datas.gif'
        }


改你的代码就是:
$(function(){  
  var tabPanel;  
//初始化默认加载第一个页签  
  tabs('tab',0,'<iframe src="工作中心.html" width="100%" height="100%" frameborder="0"></iframe>','<iframe src="用户中心.html" width="100%" height="100%" frameborder="0"></iframe>');  
function tabs(divId,activenum,content,content1){  
  tabPanel = new TabPanel({  
  renderTo:divId,  
  width: '100%',  
  height: '100%',  
  active: activenum,  
  items: [{  
    id:'workid',  
    title:'工作中心',  
    html:content,  
    closable: false  
  }],[{  
   id:'userid',  
    title:'用户中心',  
    html:content1,  
    closable: false,
    lazyload: true
  }]  
 });  
}  
}); 
0 请登录后投票
   发表时间:2010-03-29   最后修改:2010-03-30
楼主您好,我用了你给的js。但是发现了个问题不知道怎么解决?请帮忙。
问题是我在iframe中加载了一个页面,但是这个页面高度估计在2000px.这时候iframe就出现了垂直滚动条,但是不想要这个滚动条,想让这个滚动条出现在浏览器的最外面。我就想iframe的scrolling设置为no。这是iframe中加载的页面只能显示一部分。这怎么解决啊?期待您的回答。谢谢。

楼主帮忙解决下吧。我挺着急。
  • 大小: 194.3 KB
0 请登录后投票
   发表时间:2010-03-29  
寄生虫 写道
nell_zn82 写道
$(function(){
  var tabPanel;
//初始化默认加载第一个页签
  tabs('tab',0,'<iframe src="工作中心.html" width="100%" height="100%" frameborder="0"></iframe>','');
function tabs(divId,activenum,content,content1){
  tabPanel = new TabPanel({
  renderTo:divId,
  width: '100%',
  height: '100%',
  active: activenum,
  items: [{
    id:'workid',
    title:'工作中心',
    html:content,
    closable: false
  }],[{
   id:'userid',
    title:'用户中心',
    html:content1,
    closable: false
  }]
 });
}
});

//给用户中心页签添加click事件
$(#userid).click(function(){
  tabs('tab',1,'','<iframe src="用户中心.html" width="100%" height="100%" frameborder="0"></iframe>');
});


我的需求就是不加载所有的页签页面,根据点击某一个页签而加载相关的页签内容。
问题:初始化默认加载第一个页签可以成功加载,点击用户中心页签,该页签内容不显示了。


给需要延迟加载的item增加 lazyload : true 属性。
{
          title:'数据范围',
          html:'<iframe id="users" name="users" src="xxx" width="100%" height="100%" frameborder="0"></iframe>',
          closable : false,
          lazyload : true,
          icon:'../../image/icon/datas.gif'
        }


改你的代码就是:
$(function(){  
  var tabPanel;  
//初始化默认加载第一个页签  
  tabs('tab',0,'<iframe src="工作中心.html" width="100%" height="100%" frameborder="0"></iframe>','<iframe src="用户中心.html" width="100%" height="100%" frameborder="0"></iframe>');  
function tabs(divId,activenum,content,content1){  
  tabPanel = new TabPanel({  
  renderTo:divId,  
  width: '100%',  
  height: '100%',  
  active: activenum,  
  items: [{  
    id:'workid',  
    title:'工作中心',  
    html:content,  
    closable: false  
  }],[{  
   id:'userid',  
    title:'用户中心',  
    html:content1,  
    closable: false,
    lazyload: true
  }]  
 });  
}  
}); 



感谢这么及时给我回复,谢谢你,你提供的方法我试验了,没有起作用。
我在每个页签调用的页面alert输出,结果加载页面时,所有页面alert都输出了。说明还是没有延迟加载。
另外我在TabPanel.js文件里没有找到lazyload: true定义的方法。是不是我用的是旧版本???
0 请登录后投票
   发表时间:2010-03-29  
更正上面的语法:
items: [{   
    id:'workid',   
    title:'工作中心',   
    html:content,   
    closable: false  
  },{   
   id:'userid',   
    title:'用户中心',   
    html:content1,   
    closable: false  
  }]   



实在不好意思,打错了,
0 请登录后投票
   发表时间:2010-03-30  
嗯,你应该用的是旧版本,可以再下载一下最新的试试。
0 请登录后投票
   发表时间:2010-03-30   最后修改:2010-03-30
楼主您好,我用了你给的js。但是发现了个问题不知道怎么解决?请帮忙。
问题是我在iframe中加载了一个页面,但是这个页面高度估计在2000px.这时候iframe就出现了垂直滚动条,但是不想要这个滚动条,想让这个滚动条出现在浏览器的最外面。我就想iframe的scrolling设置为no。这是iframe中加载的页面只能显示一部分。这怎么解决啊?期待您的回答。谢谢。

楼主帮忙解决下吧。我挺着急。

我的浏览器是ie8
  • 大小: 194.3 KB
0 请登录后投票
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics