常用表格交替效果

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<script language="javascript">
window.onload = function() {
    doubleBgColor(document.getElementById("table1"),"#cccccc","#ffcccc")
 
}

function doubleBgColor(Table,Bg1,Bg2) {
    for (var i=0;i<Table.rows.length;i++) Table.rows[i].bgColor=i%2?Bg2:Bg1;
}
</script>
</head>

<body>
<table border="0" cellpadding="1" cellspacing="1" id="table1" width="500" bgcolor="#000000">
    <TR><TD>单 数行 </TD></TR>
    <TR><TD>双 数行</TD></TR>
    <TR><TD>单 数行</TD></TR>
    <TR><TD>双 数行</TD></TR>
    <TR><TD>单 数行</TD></TR>
    <TR><TD>双 数行</TD></TR>
    <TR><TD>单 数行</TD></TR>
    <TR><TD>双 数行</TD></TR>
    <TR><TD>单 数行</TD></TR>
    <TR><TD>双 数行</TD></TR>
    <TR><TD>单 数行</TD></TR>
    <TR><TD>双 数行</TD></TR>
</table>
<table><tr><td width="100" height="100" οnmοuseοver="style.backgroundColor='#C86F70'" οnmοuseοut="style.backgroundColor='#DDC676'" bgcolor="#DDC676">ihandu</td></tr></table>
</body>
</html> 

<style>
th {font-weight: normal; text-align:left; background: #CCCCCC}
td {background: #ffffff}
body{background:#000000}
</style>

<table>
<tr>
<th>Color First</th>
</tr>
<tr>
<td>Color Second</td>
</tr>
<tr>
<th>Color First</th>
</tr>
<tr>
<td>Color Second</td>
</tr>
<tr>
<th>Color First</th>
</tr>
<tr>
<td>Color Second</td>
</tr>
</table>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在 UniApp 中实现字幕横竖交替翻转的效果,你可以使用 Vue.js 的动画和 CSS3 的变换属性来实现。以下是一个简单的步骤说明: 1. 首先,确保你的字幕是用 Vue 组件渲染的,比如一个 `v-for` 循环遍历字幕列表。 2. 创建一个 CSS 类,例如 `.flip-text`,用于定义字幕的样式和动画: ```css .flip-text { position: absolute; transform-origin: center bottom; transition: transform 0.5s ease; } .flip-text.vertical { transform: rotateY(180deg); } .flip-text.horizontal { transform: rotateX(180deg); } ``` 3. 在 Vue 组件中,为每个字幕创建一个切换横竖状态的方法,例如 `toggleFlipAxis`,并绑定到一个触发事件(比如点击): ```html <template> <div> <span v-for="subtitle in subtitles" :key="subtitle.id" :class="{ flipText: isFlipped(subtitle) }"> {{ subtitle.text }} <button @click="toggleFlipAxis(subtitle)">Flip</button> </span> </div> </template> <script> export default { data() { return { subtitles: [ // ... ], }; }, methods: { toggleFlipAxis(subtitle) { const currentAxis = subtitle.isHorizontal ? 'horizontal' : 'vertical'; subtitle.isHorizontal = !subtitle.isHorizontal; // 倒换横竖状态 this.$refs[`subtitle-${subtitle.id}`].classList.toggle(currentAxis); }, isFlipped(subtitle) { return subtitle.isHorizontal; }, }, }; </script> ``` 4. 在模板中,为每个字幕添加一个唯一的引用,这样 Vue 可以在 JavaScript 中找到对应的元素: ```html <span ref="subtitle-{{ subtitle.id }}">{{ subtitle.text }}</span> ``` 现在,点击每个字幕,它会在横竖方向之间交替翻转。记得根据实际需求调整动画时间和方向切换逻辑。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值