Created
July 19, 2013 03:16
-
-
Save zhoufenfens/6034852 to your computer and use it in GitHub Desktop.
detail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created with JetBrains WebStorm. | |
* User: mobin | |
* Date: 13-7-16 | |
* Time: 下午3:28 | |
* To change this template use File | Settings | File Templates. | |
*/ | |
$(document).ready(function(){ | |
(function(exports){ | |
var detailController=Spine.Controller.sub({ | |
init:function(){ | |
console.log("init detail page"); | |
var that=this; | |
$(".maintab").on("tap", ".tabitems", function (e) { | |
var tappedname = $(e.target).text(); | |
switch (tappedname) { | |
case "简介": | |
that.hidetabdetail(this, "#intro"); | |
break; | |
case "新闻": | |
that.hidetabdetail(this, "#news"); | |
break; | |
case "产品": | |
that.hidetabdetail(this, "#prod"); | |
break; | |
case "应用": | |
that.hidetabdetail(this, "#appli"); | |
break; | |
} | |
}); | |
//新闻页面渲染模板 | |
var data={ | |
list:[ | |
{ | |
title:"nike trainning", | |
abstract:"持续跑步", | |
imgsrc:"img/nike.jpg" | |
}, | |
{ | |
title:"nike trainning", | |
abstract:"持续跑步", | |
imgsrc:"img/nike.jpg" | |
}, | |
{ | |
title:"nike trainning", | |
abstract:"持续跑步", | |
imgsrc:"img/nike.jpg" | |
}, | |
{ | |
title:"nike trainning", | |
abstract:"持续跑步", | |
imgsrc:"img/nike.jpg" | |
}, | |
{ | |
title:"nike trainning", | |
abstract:"持续跑步", | |
imgsrc:"img/nike.jpg" | |
} | |
] | |
}; | |
var html = template.render('test', data); | |
document.getElementById('newsisrcoller').innerHTML = html; | |
//加入isrcoll | |
var newsiscroll=new iScroll("news",{hScrollbar : true,vScrollbar:true}); | |
}, | |
hidetabdetail:function(e,id){ | |
$(".tabdetail").addClass("hide"); | |
$(".tabitems").removeClass("tapped"); | |
$(e).addClass("tapped"); | |
$(id).removeClass("hide"); | |
} | |
}); | |
exports.detailController=detailController; | |
})(window); | |
var a=new detailController(); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment