标签:
var lastIndex = 0; $(‘#click-test‘).on(‘click‘,function(){ var pages = [‘item-list‘,‘diag‘]; for(var i=0;;){ var index = parseInt(Math.random()*10) % pages.length; if(index != lastIndex){ lastIndex = index; break; } } var searchClass = pages[index]; var headerEle = $(‘.page‘).find(‘.header-nav.‘+searchClass+‘-header‘); var contentEle = $(‘.content‘).find(‘.‘+searchClass); headerEle.addClass(‘fadeInLeft‘); headerEle.siblings(‘.header-nav‘).removeClass(‘active‘); headerEle.siblings(‘.header-nav‘).addClass(‘hide‘); headerEle.removeClass(‘hide‘); contentEle.addClass(‘fadeInLeft active‘); contentEle.siblings(‘.m-content‘).removeClass(‘active‘); contentEle.siblings(‘.m-content‘).hide(); contentEle.show(); });
上面之所有用移除和添加class="hide",是因为涉及到手机端的css3的样式问题
标签:
原文地址:http://www.cnblogs.com/saodiseng/p/4700302.html