Dom与Event简洁代码实现文本展开收起

Xuijs超轻量级的框架 Dom与Event实现文本展开收起 效果图

示例代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>XuijsDemo</title>
<script src="content/scripts/xui-2.2.0.min.js"></script>
<script src="content/scripts/emile.js"></script>
<style type="text/css" media="screen">
body {
margin:0;
padding:0;
background:#F5F6FA;
}
#container {
overflow:hidden;
position:absolute;
left:0;
top:0;
width:320px;
height:480px;
}
#carda {
position:absolute;
left:0;
top:0;
width:320px;
height:480px;
background:#0073AA;
}
#cardb {
position:absolute;
left:0;
top:500px;
width:320px;
height:480px;
background:#0073AA;
}
h1 {
text-align:center;
}
button {
display:block;
font-size:2em;
width:280px;
margin:0 auto 20px auto;
}
</style>
<script>
function initialise()
{
styleshow();
dom();
fx(); }
//dom处理
function dom()
{
var o = x$('#lrc');
var s = o.html()+'';
var p =SubString(s);
x$('#lrcstr').html('inner', p);
x$('#lrcbtn').html('inner', p.length > 235 ? "点击展开" : "");
x$('#lrcbtn').on( 'click', function(e) {
var lrcbtnstr=x$('#lrcbtn').html()+"";
if(lrcbtnstr=="点击展开")
{
x$('#lrcstr').html('inner', s);
x$('#lrcbtn').html('inner', '点击收起');
}
else{
x$('#lrcbtn').html('inner', p.length > 235 ? "点击展开" : "");
x$('#lrcstr').html('inner', p);
}
// alert(x$('#lrcbtn').html());
});
x$('#lrc').html("");
//alert(s);
}
function SubString(s){
var str; // 声明变量。
str = s.substr(1,236); // 截取取字符串。
return(str); // 返回字符串。
}
//style 样式处理
function styleshow()
{ }
//style 动画、形变、渐变
function fx()
{ } </script>
</head>
<body onload="initialise();">
<div id="carda">
<div id="lrc"> Come Here
Artist: Kath Bloom There's wind that blows in from the north.
And it says that loving takes this course.
Come here. Come here.
No I'm not impossible to touch
I have never wanted you so much.
Come here. Come here.
Have I never laid down by your side.
Baby, let's forget about this pride.
Come here. Come here.
Well I'm in no hurry.
Don't have to run away this time.
I know you're timid.
But it's gonna be all right this time.
There's wind that blows in from the north.
And it says that loving takes this course.
Come here. Come here.
---END--- </div>
<br />
<div id="lrcstr"></div>
<br />
<div id="lrcbtn"></div>
<br />
</div>
</body>
</html>

代码示例包

点击下载

声明:本博客高度重视知识产权保护,发现本博客发布的信息包含有侵犯其著作权的链接内容时,请联系我,我将第一时间做相应处理,联系邮箱ffgign@qq.com

作者:Mark Fan (小念头)    来源:http://cube.cnblogs.com
说明:未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。如有疑问,可以通过 ffgign@qq.com 联系作者,本文章采用 知识共享署名-非商业性使用-相同方式共享 2.5 中国大陆许可协议进行许可

跨平台移动开发 Xuijs超轻量级的框架 Dom与Event简洁代码实现文本展开收起的更多相关文章

  1. 跨平台移动开发 Xuijs超轻量级的框架+Emile CSS动画

    Xuijs超轻量级的框架+Emile CSS动画效果图 示例代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional// ...

  2. 跨平台移动开发 Xuijs超轻量级的框架Style CSS属性用法

    PhoneGap里面推荐使用的超轻量级的框架 Style CSS属性用法 设置css属性:setstyle 通过ID设置css属性 x$('#top1').setStyle('color', '#DB ...

  3. 分享自己的超轻量级高性能ORM数据访问框架Deft

    Deft 简介 Deft是一个超轻量级高性能O/R mapping数据访问框架,简单易用,几分钟即可上手. Deft包含如下但不限于此的特点: 1.按照Transact-SQL的语法语义风格来设计,只 ...

  4. 基于领域驱动设计(DDD)超轻量级快速开发架构

    smartadmin.core.urf 这个项目是基于asp.net core 3.1(最新)基础上参照领域驱动设计(DDD)的理念,并参考目前最为了流行的abp架构开发的一套轻量级的快速开发web ...

  5. 基于领域驱动设计(DDD)超轻量级快速开发架构(二)动态linq查询的实现方式

    -之动态查询,查询逻辑封装复用 基于领域驱动设计(DDD)超轻量级快速开发架构详细介绍请看 https://www.cnblogs.com/neozhu/p/13174234.html 需求 配合Ea ...

  6. 前端开发福音!阿里Weex跨平台移动开发工具开源-b

    阿里巴巴今天在Qcon大会上宣布跨平台移动开发工具Weex开放内测邀请.Weex能够完美兼顾性能与动态性,让移动开发者通过简捷的前端语法写出Native级别的性能体验,并支持iOS.安卓.YunOS及 ...

  7. [.net 面向对象程序设计深入](5)MVC 6 —— 构建跨平台.NET开发环境(Windows/Mac OS X/Linux)

    [.net 面向对象程序设计深入](5)MVC 6 —— 构建跨平台.NET开发环境(Windows/Mac OS X/Linux) 1.关于跨平台 上篇中介绍了MVC的发展历程,说到ASP.NET ...

  8. 全球首个全流程跨平台界面开发套件,PowerUI分析

    一.       首个全流程跨平台界面开发套件,PowerUI正式发布 UIPower在DirectUI的基础上,自主研发全球首个全流程跨平台界面开发套件PowerUI(PUI)正式发布,PowerU ...

  9. 【转贴】-- 基于QT的跨平台应用开发

    原帖地址:http://www.cnblogs.com/R0b1n/p/4106613.html 1 Qt简介 Qt是1991年奇趣科技开发的一个跨平台的C++图形用户界面应用程序框架.它提供给应用程 ...

随机推荐

  1. jq serialize 系列化 乱码 解决办法

    query = form.find('input,select,textarea').serialize(); $.post(target,decodeURIComponent(query)).suc ...

  2. java中Statement详细用法。

    1.创建 Statement 对象 建立了到特定数据库的连接之后,就可用该连接发送 SQL 语句.Statement 对象用 Connection 的方法createStatement 创建,如下列代 ...

  3. python 自动化之路 day 20 Django进阶/BBS项目【一】

    一.django进阶 1.django orm 增删改查 1.1.创建表: 1 2 3 >>> from blog.models import Blog >>> b ...

  4. 整理的一些java中常使用jar包以及说明

    slf4j:Simple Logging Facade for Java SLF4J,即简单日志门面(Simple Logging Facade for Java),不是具体的日志解决方案,它只服务于 ...

  5. cocos2d-x之读开发技术精解

    引擎位置(依次往下): 游戏App->逻辑与规则->引擎->运行的平台->硬件接口(驱动运行库API) 1. 渲染框架 CCNode绘制基类(引擎核心类都继承于它,形成一个链表 ...

  6. [ACM] hdu 3923 Invoker (Poyla计数,高速幂运算,扩展欧几里得或费马小定理)

    Invoker Problem Description On of Vance's favourite hero is Invoker, Kael. As many people knows Kael ...

  7. Sass mixin 使用css border属性画三角形

    To be finished. //triangle@mixin css-triangle ($direction: "down", $size: 20px, $color: #0 ...

  8. 《从零开始学Swift》学习笔记(Day 36)——静态方法

    原创文章,欢迎转载.转载请注明:关东升的博客 静态方法与静态属性类似,Swift中定义了静态方法,也称为类型方法.静态方法的定义与静态属性类似,枚举和结构体的静态方法使用的关键字是static:类静态 ...

  9. extract

    w http://php.net/manual/en/function.extract.php <?php /* Suppose that $var_array is an array retu ...

  10. 类 Stack<E>

    Stack类 Stack 类表示后进先出(LIFO)的对象堆栈.它通过五个操作对类 Vector 进行了扩展 ,允许将向量视为堆栈. 它提供了通常的 push 和 pop 操作,以及取堆栈顶点的 pe ...