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. iOS类目

    首先我们解释一下类目是什么 iOS中类目是为给已经存在的类加入新的方法.(可是不能加入实例变量) 也就是说 我们已经有一个类了 .可是我们发现这个类眼下所提供的方法,满足不了我们的需求,我们须要新的方 ...

  2. 微信小程序 一些要点

    微信小程序,weixin,关于微信小程序,那些开发文档没有告诉你的-微信小程序开发资源-微信开发者平台,微信开发者社区,微信小程序开发者社区 Discuz! Team and Comsenz UI T ...

  3. C++ 虚析构(virtual destructor)原理

    注意:本文仅为个人理解,可能有误! 先看一段代码: #include <iostream> using namespace std; class CBase{ public: CBase( ...

  4. eclipse 4.3 汉化

    打开浏览器,浏览“参考资料”内给出的“eclipse语言包下载”地址,在博客新页面找到地址链接,如图所示.“Babel Language...”开头的一栏下面就是各个eclise版本的语言包,此处以I ...

  5. SQL获取某个时间字符串里的月和日,获取某天是周几

    select datename(weekday,'2016-11-4') as '周' select convert(varchar,datepart(month,'2016-11-4')) as ' ...

  6. view {display:block}

    view {display:block}

  7. C++常备知识总结

    1.extern表示是外部函数或外部变量,比如: 1.extern void add(int x,inty);表示该函数主体不在当前模块中,在另一个模块中(文件)2.extern int total; ...

  8. 常用的数据库sql语句

    create table query_audit_log(Time varchar(255) default null,Id int(10) default null, Command varchar ...

  9. 避免每次都用sudo使用docker

    默认安装完 docker 后,每次执行 docker 都需要运行 sudo 命令,非常浪费时间影响效率.如果不跟 sudo,直接执行 docker images 命令会有如下问题: FATA[0000 ...

  10. 设置mysql外网访问

    任意主机以用户root和密码mypwd连接到mysql服务器mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'myp ...