甜甜的泥土

TAB切换

  • blackberry
  • apple
  • thinkpad
  • sony
  • when i was young i have love talk about the dream
  • that you are listen to with smile
  • as the time by,we have miss each other
  • sine i have make a dream
  • when i weak up,i find you are gone
  • how i want you know that how i miss you
  • sine i have make a dream
  • when i weak up,i find you are gone
  • how i want you know that how i miss you
  • when i was young i have love talk about the dream
  • that you are listen to with smile
  • as the time by,we have miss each other
  • when i was young i have love talk about the dream
  • as the time by,we have miss each other
  • sine i have make a dream
  • when i weak up,i find you are gone
  • that you are listen to with smile
  • how i want you know that how i miss you
  • sine i have make a dream
  • when i weak up,i find you are gone
  • how i want you know that how i miss you
  • when i was young i have love talk about the dream
  • that you are listen to with smile
  • as the time by,we have miss each other
                    
(function() {
    var title = document.getElementsByClassName('tab-tit')[0].getElementsByTagName('li');
    var content = document.getElementsByClassName('tab-con')[0].getElementsByTagName('div');
    for (var i = 0; i < title.length; i++) {
        title[i].id = i;
        title[i].onmouseenter = function(){
            var siblings = getSiblings(this);
            for (var i = 0; i < siblings.length; i++) {
                siblings[i].classList.remove('on');
            }
            this.classList.add('on');
            tabSwitch(parseInt(this.id));
        }
    }
    var tabSwitch = function(index){
        content[index].style.display = 'block';
        var siblings = getSiblings(content[index]);
        for (var i = 0; i < siblings.length; i++) {
            siblings[i].style.display = 'none';
        }
    }
})();
function getSiblings(o){ 
    var a=[];
    var p=o.previousSibling; 
    while(p){ 
        if(p.nodeType===1){ 
            a.push(p); 
        } 
        p=p.previousSibling;
    } 
    a.reverse();
    var n=o.nextSibling; 
    while(n){
        if(n.nodeType===1){ 
            a.push(n); 
        } 
        n=n.nextSibling; 
    } 
    return a;
}