首页
Search
1
python生成剪映草稿解析
2,851 阅读
2
Vue vben admin 2.0的封装部分坑点
1,876 阅读
3
时间的风景/TimeScapes 母带Rip (1080p/4K) 下载
1,607 阅读
4
VUE中使用mathjs的方法
1,551 阅读
5
百度地图坐标系对腾讯地图坐标系转换
1,510 阅读
技术宅的演示性文稿
技术宅的吐槽文档
一个的舞台
唱唱反调
老文章归档
光年计划
登录
Search
标签搜索
老文章
CS
长春
大学
程序员
vue
酷游CS俱乐部
dedecms
织梦
php
vant
小程序
军训
缘
ie6
google
大连
2012
js
ecshop
茶树虾
累计撰写
306
篇文章
累计收到
129
条评论
首页
栏目
技术宅的演示性文稿
技术宅的吐槽文档
一个的舞台
唱唱反调
老文章归档
光年计划
页面
搜索到
302
篇与
teaxia
的结果
2014-11-17
这30类CSS选择器 你必须记在脑袋里!
大概大家都知道id,class以及descendant选择器,并且整体都在使用它们,那么你正在错误拥有更大级别的灵活性的选择方式。这篇文章里面提到的大部分选择器都是在CSS3标准下的,所以它们只能在相应最新版本的浏览器中才能生效,你完全应该把这些都记在你聪明的脑袋里面。 1. * 1 2 3 4 * { margin: 0; padding: 0;} 在我们看比较高级的选择器之前,应该认识下这个众所周知的清空选择器。星号呢会将页面上所有每一个元素都选到。许多开发者都用它来清空margin和padding。当然你在练习的时候使用这个没问题,但是我不建议在生产环境中使用它。它会给浏览器凭添许多不必要的东西。 *也可以用来选择某元素的所有子元素。 1 2 3 #container * { border: 1px solid black;} 它会选中#container下的所有元素。当然,我还是不建议你去使用它,如果可能的话。 DEMO 兼容性 IE6+ Firefox Chrome Safari Opera 2. #X 1 2 3 4 #container { width: 960px; margin: auto;} 在选择器中使用#可以用id来定位某个元素。大家通常都会这么使用,然后使用的时候大家还是得相当小心的。 需要问自己一下:我是不是必须要给这个元素来赋值个id来定位它呢? id选择器是很严格的并且你没办法去复用它。如果可能的话,首先试试用标签名字,HTML5中的新元素,或者是伪类。 DEMO 兼容性 IE6+ Firefox Chrome Safari Opera 3. .X 1 2 3 .error { color: red;} 这是个class选择器。它跟id选择器不同的是,它可以定位多个元素。当你想对多个元素进行样式修饰的时候就可以使用class。当你要对某个特定的元素进行修饰那就是用id来定位它。 DEMO 兼容性 IE6+ Firefox Chrome Safari Opera 4. X Y 1 2 3 li a { text-decoration: none;} 下一个常用的就是descendant选择器。如果你想更加具体的去定位元素,你可以使用它。例如,假如,你不需要定位所有的a元素,而只需要定位li标签下的a标签?这时候你就需要使用descendant选择器了。 专家提示:如果你的选择器像X Y Z A B.error这样,那你就错了。时刻都提醒自己,是否真的需要对那么多元素修饰。 DEMO 兼容性 IE6+ Firefox Chrome Safari Opera 5. X 1 2 a { color: red; }ul { margin-left: 0; } 如果你想定位页面上所有的某标签,不是通过id或者是’class’,这简单,直接使用类型选择器。 DEMO 兼容性 IE6+ Firefox Chrome Safari Opera 6. X:visited and X:link 1 2 a:link {color:red;}a:visited {color: purple;} 我们使用:link这个伪类来定位所有还没有被访问过的链接。 另外,我们也使用:visited来定位所有已经被访问过的链接。 DEMO 兼容性 IE7+ Firefox Chrome Safari Opera 7. X+Y 1 2 3 ul + p { color: red;} 这个叫相邻选择器。它指挥选中指定元素的直接后继元素。上面那个例子就是选中了所有ul标签后面的第一段,并将它们的颜色都设置为红色。 DEMO 兼容性 IE7+ Firefox Chrome Safari Opera 8. X>Y 1 2 3 div#container > ul { border: 1px solid black;} X Y和X > Y的差别就是后面这个指挥选择它的直接子元素。看下面的例子: 1 2 3 4 5 6 7 8 9 10 11 12 <div id="container"> <ul> <li> List Item <ul> <li> Child </li> </ul> </li> <li> List Item </li> <li> List Item </li> <li> List Item </li> </ul></div> #container > ul只会选中id为’container’的div下的所有直接ul元素。它不会定位到如第一个li下的ul元素。 由于某些原因,使用子节点组合选择器会在性能上有许多的优势。事实上,当在javascript中使用css选择器时候是强烈建议这么做的。 DEMO 兼容性 IE7+ Firefox Chrome Safari Opera 9. X ~ Y 1 2 3 ul ~ p { color: red;} 兄弟节点组合选择器跟X+Y很相似,然后它又不是那么的严格。ul + p选择器只会选择紧挨跟着指定元素的那些元素。而这个选择器,会选择跟在目标元素后面的所有匹配的元素。 DEMO 兼容性 IE7+ Firefox Chrome Safari Opera 10. X[title] 1 2 3 a[title] { color: green;} 这个叫属性选择器,上面的这个例子中,只会选择有title属性的元素。那些没有此属性的锚点标签将不会被这个代码修饰。那再想想如果你想更加具体的去筛选?那… DEMO 兼容性 IE7+ Firefox Chrome Safari Opera 11. X[href="foo"] 1 2 3 a[href="http://strongme.cn"] { color: #1f6053; /* nettuts green */} 上面这片代码将会把href属性值为http://strongme.cn的锚点标签设置为绿色,而其他标签则不受影响。注意我们将值用双引号括起来了。那么在使用Javascript的时候也要使用双引号括起来。可以的话,尽量使用标准的CSS3选择器。 这样可以用了,但是还是有点死,如果不是这个链接,而是类似的链接,那么这时就得用正则表达式了。 DEMO 兼容性 IE7+ Firefox Chrome Safari Opera 12. X[href*="strongme"] 1 2 3 a[href*="strongme"] { color: #1f6053;} Tada,正是我们需要的,这样,就指定了strongme这个值必须出现在锚点标签的href属性中,不管是strongme.cn还是strongme.com还是www.strongme.cn都可以被选中。 但是记得这是个很宽泛的表达方式。如果锚点标签指向的不是strongme相关的站点,如果要更加具体的限制的话,那就使用^和$,分别表示字符串的开始和结束。 DEMO 兼容性 IE7+ Firefox Chrome Safari Opera 13. X[href^="href"] 1 2 3 4 a[href^="http"] { background: url(path/to/external/icon.png) no-repeat; padding-left: 10px;} 大家肯定好奇过,有些站点的锚点标签旁边会有一个外链图标,我也相信大家肯定见过这种情况。这样的设计会很明确的告诉你会跳转到别的网站。 用克拉符号就可以轻易做到。它通常使用在正则表达式中标识开头。如果我们想定位锚点属性href中以http开头的标签,那我们就可以用与上面相似的代码。注意我们没有搜索http://,那是没必要的,因为它都不包含https://。 那如果我们想找到所有指向一张图片的锚点标签呢?那我们来使用下&字符。 DEMO 兼容性 IE7+ Firefox Chrome Safari Opera 14. X[href$=".jpg"] 1 2 3 a[href$=".jpg"] { color: red;} 这次我们又使用了正则表达式$,表示字符串的结尾处。这段代码的意思就是去搜索所有的图片链接,或者其它链接是以.jpg结尾的。但是记住这种写法是不会对gifs和pngs起作用的。 DEMO 兼容性 IE7+ Firefox Chrome Safari Opera 15. X[data-*="foo"] 1 2 3 a[data-filetype="image"] { color: red;} 在回到第8条,我们如何把所有的图片类型都选中呢png,jpeg,’jpg’,’gif’?我们可以使用多选择器。看下面: 1 2 3 4 5 6 a[href$=".jpg"],a[href$=".jpeg"],a[href$=".png"],a[href$=".gif"] { color: red;} 但是这样写着很蛋疼啊,而且效率会很低。另外一个办法就是使用自定义属性。我们可以给每个锚点加个属性data-filetype指定这个链接指向的图片类型。 1 <a href="path/to/image.jpg" data-filetype="image"> Image Link </a 那有了这个钩子,我们就可以去用标准的办法只去选定文件类型为image的锚点了。 1 2 3 a[data-filetype="image"] { color: red;} DEMO 兼容性 IE7+ Firefox Chrome Safari Opera 16. X[foo~="bar"] 1 2 3 4 5 6 7 a[data-info~="external"] { color: red;}a[data-info~="image"] { border: 1px solid black;} 这个我想会让你的小伙伴惊呼妙极了。很少有人知道这个技巧。这个~符号可以定位那些某属性值是空格分隔多值的标签。 继续使用第15条那个例子,我们可以设置一个data-info属性,它可以用来设置任何我们需要的空格分隔的值。这个例子我们将指示它们为外部连接和图片链接。 1 <a href="path/to/image.jpg" data-info="external image"> Click Me, Fool </a> 给这些元素设置了这个标志之后,我们就可以使用~来定位这些标签了。 1 2 3 4 5 6 7 8 9 /* Target data-info attr that contains the value "external" */a[data-info~="external"] { color: red;}/* And which contain the value "image" */a[data-info~="image"] { border: 1px solid black;} 17. X:checked 1 2 3 input[type=radio]:checked { border: 1px solid black;} 上面这个伪类写法可以定位那些被选中的单选框和多选框,就是这么简单。 DEMO 兼容性 IE9+ Firefox Chrome Safari Opera 18. X:after before和after这俩伪类。好像每天大家都能找到使用它们的创造性方法。它们会在被选中的标签周围生成一些内容。 当使用.clear-fix技巧时许多属性都是第一次被使用到里面的。 1 2 3 4 5 6 7 8 9 10 11 12 13 .clearfix:after { content: ""; display: block; clear: both; visibility: hidden; font-size: 0; height: 0; }.clearfix { *display: inline-block; _height: 1%;} 上面这段代码会在目标标签后面补上一段空白,然后将它清除。这个方法你一定得放你的聚宝盆里面。特别是当overflow:hidden方法不顶用的时候,这招就特别管用了。 还想看其他创造性的使用这个伪类,看这里。根据CSS3标准规定,可以使用两个冒号`::`。然后为了兼容性,浏览器也会接受一个双引号的写法。其实在这个情况下,用一个冒号还是比较明智的。 兼容性 IE8+ Firefox Chrome Safari Opera 19. X::hover 1 2 3 div:hover { background: #e3e3e3;} 不用说,大家肯定知道它。官方的说法是user action pseudo class.听起来有点儿迷糊,其实还好。如果想在用户鼠标飘过的地方涂点儿彩,那这个伪类写法可以办到。注意旧版本的IE只会对加在锚点`a`标签上的`:hover`伪类起作用。 通常大家在鼠标飘过锚点链接时候加下边框的时候用到它。 1 2 3 a:hover { border-bottom: 1px solid black;} 专家提示:border-bottom:1px solid black;比text-decoration:underline;要好看很多。 兼容性 IE6+(IE6只能在锚点标签上起作用) Firefox Chrome Safari Opera 20. X:not(selector) 1 2 3 div:not(#container) { color: blue;} 取反伪类是相当有用的,假设我们要把除id为container之外的所有div标签都选中。那上面那么代码就可以做到。 或者说我想选中所有出段落标签之外的所有标签。 1 2 3 *:not(p) { color: green;} DEMO 兼容性 IE9+ Firefox Chrome Safari Opera 21. X::pseudoElement 1 2 3 4 p::first-line { font-weight: bold; font-size:1.2em;} 我们可以使用::来选中某标签的部分内容,如地一段,或者是第一个字没有。但是记得必须使用在块式标签上才起作用。伪标签是由两个冒号`::`组成的。 定位第一个字 1 2 3 4 5 6 7 p::first-letter { float: left; font-size: 2em; font-weight: bold; font-family: cursive; padding-right: 2px;} 上面这段代码会找到页面上所有段落,并且指定为每一段的第一个字。 它通常在一些新闻报刊内容的重点突出会使用到。 定位某段的第一行 1 2 3 4 p::first-line { font-weight: bold; font-size: 1.2em;} 跟::first-line相似,会选中段落的第一行 。 为了兼容性,之前旧版浏览器也会兼容单冒号的写法,例如:first-line,:first-letter,:before,:after.但是这个兼容对新介绍的特性不起作用。 DEMO 兼容性 IE6+ Firefox Chrome Safari Opera 22. X:nth-child(n) 1 2 3 li:nth-child(3) { color: red;} 还记得我们面对如何取到推跌式标签的第几个元素是无处下手的时光么,有了nth-child那日子就一去不复返了。 请注意nth-child接受一个整形参数,然后它不是从0开始的。如果你想获取第二个元素那么你传的值就是li:nth-child(2). 我们甚至可以获取到由变量名定义的个数个子标签。例如我们可以用li:nth-child(4n)去每隔3个元素获取一次标签。 DEMO 兼容性 IE9+ Firefox3.5+ Chrome Safari 23. X:nth-last-child(n) 1 2 3 li:nth-last-child(2) { color: red;} 假设你在一个ul标签中有N多的元素,而你只想获取最后三个元素,甚至是这样li:nth-child(397),你可以用nth-last-child伪类去代替它。 这个技巧可以很正确的代替第16个TIP,不同的就是它是从结尾处开始的,倒回去的。 DEMO 兼容性 IE9+ Firefox3.5+ Chrome Safari Opera 24. X:nth-of-type(n) 1 2 3 ul:nth-of-type(3) { border: 1px solid black;} 曾几何时,我们不想去选择子节点,而是想根据元素的类型来进行选择。 想象一下有5个ul标签。如果你只想对其中的第三个进行修饰,而且你也不想使用id属性,那你就可以使用nth-of-type(n)伪类来实现了,上面的那个代码,只有第三个ul标签会被设置边框。 DEMO 兼容性 IE9+ Firefox3.5+ Chrome Safari 25. X:nth-last-of-type(n) 1 2 3 ul:nth-last-of-type(3) { border: 1px solid black;} 同样,也可以类似的使用nth-last-of-type来倒序的获取标签。 兼容性 IE9+ Firefox3.5+ Chrome Safari Opera 26. X:first-child 1 2 3 ul li:first-child { border-top: none;} 这个结构性的伪类可以选择到第一个子标签,你会经常使用它来取出第一个和最后一个的边框。 假设有个列表,没个标签都有上下边框,那么效果就是第一个和最后一个就会看起来有点奇怪。这时候就可以使用这个伪类来处理这种情况了。 DEMO 兼容性 IE7+ Firefox Chrome Safari Opera 27. X:last-child 1 2 3 ul > li:last-child { color: green;} 跟first-child相反,last-child取的是父标签的最后一个标签。 例如标签 1 2 3 4 5 <ul> <li> List Item </li> <li> List Item </li> <li> List Item </li></ul> 1 2 3 4 5 6 7 8 9 10 11 12 13 ul { width: 200px; background: #292929; color: white; list-style: none; padding-left: 0;}li { padding: 10px; border-bottom: 1px solid black; border-top: 1px solid #3c3c3c;} 上面的代码将设置背景色,移除浏览器默认的内边距,为每个li设置边框以凸显一定的深度。 List Item List Item List Item DEMO 兼容性 IE9+ Firefox Chrome Safari Opera 28. X:only-child 1 2 3 div p:only-child { color: red;} 说实话,你会发现你几乎都不会用到这个伪类。然而,它是可用的,有会需要它的。 它允许你获取到那些只有一个子标签的父标签。就像上面那段代码,只有一个段落标签的div才被着色。 1 2 3 4 5 6 <div><p> My paragraph here. </p></div> <div> <p> Two paragraphs total. </p> <p> Two paragraphs total. </p></div> 上面例子中,第二个div不会被选中。一旦第一个div有了多个子段落,那这个就不再起作用了。 DEMO 兼容性 IE9+ Firefox Chrome Safari Opera 29. X:only-of-type 1 2 3 li:only-of-type { font-weight: bold;} 结构性伪类可以用的很聪明。它会定位某标签只有一个子标签的目标。设想你想获取到只有一个子标签的ul标签? 使用ul li会选中所有li标签。这时候就要使用only-of-type了。 1 2 3 ul > li:only-of-type { font-weight: bold;} DEMO 兼容性 IE9+ Firefox 3.5+ Chrome Safari Opera 30. X:first-of-type first-of-type伪类可以选择指定标签的第一个兄弟标签。 测试 1 2 3 4 5 6 7 8 9 10 11 12 <div> <p> My paragraph here. </p> <ul> <li> List Item 1 </li> <li> List Item 2 </li> </ul> <ul> <li> List Item 3 </li> <li> List Item 4 </li> </ul> </div> 来你把List Item 2取出来,如果你已经取出来或者是放弃了,来继续。 解决办法1 办法很多,我们看一些比较方便的。首先是first-of-type。 1 2 3 ul:first-of-type > li:nth-child(2) { font-weight: bold;} 找到第一个ul标签,然后找到直接子标签li,然后找到第二个子节点。 解决办法2 另一个解决办法就是邻近选择器。 1 2 3 p + ul li:last-child { font-weight: bold;} 这种情况下,找到p下的直接ul标签,然后找到它的最后一个直接子标签。 解决办法3 我们可以随便玩耍这些选择器。来看看: 1 2 3 ul:first-of-type li:nth-last-child(1) { font-weight: bold; } 先获取到页面上第一个ul标签,然后找到最后一个子标签。 DEMO 兼容性 IE9+ Firefox 3.5+ Chrome Safari Opera 结论 如果你想向旧版本浏览器妥协,比如IE6,那你用这些新的选择器的时候还是得小心点。但别别让IE6阻止你去学这些新的技能。那你就对自己太残忍了。记得多查查兼容性列表,或者使用Dean Edward’s excellent IE9.js script 来让你的浏览器具有这些特性。 第二个,使用向jQuery的时候,尽量使用原生的CSS3选择器。可能 活让你的代码跑的很快。这样选择器引擎就可以使用浏览器原生解析器,而不是选择器自己的。 英文原文:tutsplus ,译文:译邻
2014年11月17日
264 阅读
0 评论
0 点赞
2014-11-07
时间的风景/TimeScapes 母带Rip (1080p/4K) 下载
时间的风景/TimeScapes 母带Rip (1080p/4K) 下载时间的风景,一部壮美的4K纪录片,画质极佳,得益于高端的拍摄器材,画面干净细腻,锐度惊人!配乐同样优美。随手截图,绝对可以做电脑桌面!雄伟壮观的延时摄影,真实纪录了美洲的国家公园!如果你没体验过斗转星移,日夜星辰…… 那就一起来吧。此片感谢@emulevc 豪掷299美刀购买了最贵的版本–Cineform 4K版。内部编码为RGB36bit,经过官方解码器读出为YUV422p8版本(即8bit精度YUV格式,亮度分辨率为4096×2304,色度分辨率为2048×2304)。通过顺丰快递寄硬盘给我们进行压制(一天传输400多GB数据,看来卡车拉硬盘等效带宽约为5MB/s)因为能获取如此高的分辨率,所以我们做了两个版本(负责压制的组员:黑化启人):1080p版:采用YUV444p10格式,即亮度和色度都由片源分辨率降低到1920×1080,然后用10bit精度编码,并封装无损2.0音轨。这样做的好处不仅在于downscale质量高,更在于可以完整的保留颜色信息。如果采用常见的编码方式(YUV420),色度只能以1/4分辨率记录。即便是1440p,画质也不会更好(只有亮度为2560×1440,但是色度仅为1280×720;如果是1080p的分辨率,那么亮度是1920×1080,色度是960×540)。手头有那个1440p web版的可以大胆扔了。4K版:采用YUV422p10格式,即亮度和色度保留片源的分辨率,然后采用10bit压制,内封2.0ch音轨,外挂5.1ch音轨。比起那些常见的视频压制格式,这样做在于避免色度被减半(常见的视频处理需要将色度由2048×2304降低为2048×1152)以上版本的硬解兼容都不好,只适合在PC上播放。因为源本身被分享了,各大PT站应该会放出适合硬解的版本(比如wiki就压制了一个适合硬解的4K版),这里我们就不再制作了(反正画质不会更好,因为那样颜色信息先得扔掉一半) 下载地址:1080p:http://pan.baidu.com/share/link?shareid=1401659547&uk=4160841784http://bt.ktxp.com/html/2014/0104/336581.htmlhttp://share.dmhy.org/topics/view/332590_VCB-S_TimeScapes_YUV444p10_1080p_4K.htmlhttp://www.nyaa.se/?page=view&tid=508416http://www.tsdm.net/forum.php?mod=viewthread&tid=423404&extra=page%3D1 4K:http://bt.ktxp.com/html/2014/0105/336670.htmlhttp://share.dmhy.org/topics/view/332671_VCB-S_TimeScapes_YUV422p10_2304p_4K.htmlhttp://www.nyaa.se/?page=view&tid=508670http://www.tsdm.net/forum.php?mod=viewthread&tid=423429&extra=page%3D1
2014年11月07日
1,607 阅读
0 评论
0 点赞
2014-05-20
jQuery/CSS3鼠标点击爆炸效果
首先头部引用jquery库然后把以下JS单独存为一个js文件,引用进去$(document).ready(function() { // Generate the clips. In this case I'm using 5 (or 25 pieces) (genClips = function() { // For easy use $t = $('.clipped-box'); // Like I said, we're using 5! var amount = 5; // Get the width of each clipped rectangle. var width = $t.width() / amount; var height = $t.height() / amount; // The total is the square of the amount var totalSquares = Math.pow(amount, 2); // The HTML of the content var html = $t.find('.content').html(); var y = 0; for(var z = 0; z <= (amount*width); z = z+width) { $('<div style="clip: rect('+y+'px, '+(z+width)+'px, '+(y+height)+'px, '+z+'px)">'+html+'</div>').appendTo($t); if(z === (amount*width)-width) { y = y + height; z = -width; } if(y === (amount*height)) { z = 9999999; } } })(); // A quick random function for selecting random numbers function rand(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } // A variable check for when the animation is mostly over var first = false, clicked = false; // On click $('.clipped-box div').on('click', function() { if(clicked === false) { clicked = true; $('.clipped-box .content').css({'display' : 'none'}); // Apply to each clipped-box div. $('.clipped-box div:not(.content)').each(function() { // So the speed is a random speed between 90m/s and 120m/s. I know that seems like a lot // But otherwise it seems too slow. That's due to how I handled the timeout. var v = rand(120, 90), angle = rand(80, 89), // The angle (the angle of projection) is a random number between 80 and 89 degrees. theta = (angle * Math.PI) / 180, // Theta is the angle in radians g = -9.8; // And gravity is -9.8. If you live on another planet feel free to change // $(this) as self var self = $(this); // time is initially zero, also set some random variables. It's higher than the total time for the projectile motion // because we want the squares to go off screen. var t = 0, z, r, nx, ny, totalt = 15; // The direction can either be left (1), right (-1) or center (0). This is the horizontal direction. var negate = [1, -1, 0], direction = negate[ Math.floor(Math.random() * negate.length) ]; // Some random numbers for altering the shapes position var randDeg = rand(-5, 10), randScale = rand(0.9, 1.1), randDeg2 = rand(30, 5); // Because box shadows are a bit laggy (by a bit I mean 'box shadows will not work on individual clipped divs at all') // we're altering the background colour slightly manually, in order to give the divs differentiation when they are // hovering around in the air. var color = $(this).css('backgroundColor').split('rgb(')[1].split(')')[0].split(', '), colorR = rand(-20, 20), // You might want to alter these manually if you change the color colorGB = rand(-20, 20), // To get the right consistency. newColor = 'rgb('+(parseFloat(color[0])+colorR)+', '+(parseFloat(color[1])+colorGB)+', '+(parseFloat(color[2])+colorGB)+')'; // And apply those $(this).css({ 'transform' : 'scale('+randScale+') skew('+randDeg+'deg) rotateZ('+randDeg2+'deg)', 'background' : newColor }); // Set an interval z = setInterval(function() { // Horizontal speed is constant (no wind resistance on the internet) var ux = ( Math.cos(theta) * v ) * direction; // Vertical speed decreases as time increases before reaching 0 at its peak var uy = ( Math.sin(theta) * v ) - ( (-g) * t); // The horizontal position nx = (ux * t); // s = ut + 0.5at^2 ny = (uy * t) + (0.5 * (g) * Math.pow(t, 2)); // Apply the positions $(self).css({'bottom' : (ny)+'px', 'left' : (nx)+'px'}); // Increase the time by 0.10 t = t + 0.10; // If the time is greater than the total time clear the interval if(t > totalt) { clicked = false; first = true; $('.clipped-box').css({'top' : '-1000px', 'transition' : 'none'}); $(self).css({'left' : '0', 'bottom' : '0', 'opacity' : '1', 'transition' : 'none', 'transform' : 'none'}); // Finally clear the interval clearInterval(z); } }, 10); // Run this interval every 10ms. Changing this will change the pace of the animation }); } }); r = setInterval(function() { // This is a bit rough but it does the job if(first === true) { // I've just put this in so the deleted box will come down again after its been clicked. // That way you can keep pressing delete. $('.clipped-box').css({'top' : '0', 'transition' : ''}); $('.clipped-box div').css({'opacity' : '1', 'transition' : '', 'background-color' : ''}); $('.content').css({'display' : 'block'}); first = false; } }, 300); });然后把以下DIV嵌入进去就可以了 <div class="container"> <div class="clipped-box"> <div class="content"> <h1>CLICK TO DELETE ME</h1> <p>I'll explode into pieces!</p> </div> </div> </div>
2014年05月20日
322 阅读
0 评论
0 点赞
2014-02-25
关于图片在IE不能打开,其他浏览器能打开的原因……
首先,真觉得这是一件涨知识的事儿。网站上我上传的路径没有中文路径,在IE下这张图片死活显示是一个X,但是我在chrome里面就可以正常打开。这是让人百思不得其解。后来在一个技术群里面问了下,他们说是图片模式是CMYK的原因,可能浏览器不认这个颜色模式。以前总觉得颜色模式这种东西只有在印刷的时候才能体现出来,现在看来在网站上面也有很明显的体现。后来把那张图片的颜色模式改成RGB以后,图片都正常显示了!
2014年02月25日
372 阅读
0 评论
0 点赞
2014-02-13
Phpcms V9 调用全站最新文章的代码
调用栏目下最新文章,很简单,action="postion"改为"lists",一定要加上catid{pc:content action="lists" catid="72" num="8" order="id DESC"} <UL> {loop $data $r} <LI><a href="{$r[url]}" target="_blank">{str_cut($r[title],36,'')}</a></LI> {/loop} </UL>{/pc} Phpcms默认不支持调用全站最新文章,需要修改文件:\phpcms\modules\content\classes\content_tag.class.php,找到以下函数: /** * 列表页标签 * @param $data */ public function lists($data) { $catid = intval($data['catid']); if(!$this->set_modelid($catid)) return false; if(isset($data['where'])) { $sql = $data['where']; } else { $thumb = intval($data['thumb']) ? " AND thumb != ''" : ''; if($this->category[$catid]['child']) { $catids_str = $this->category[$catid]['arrchildid']; $pos = strpos($catids_str,',')+1; $catids_str = substr($catids_str, $pos); $sql = "status=99 AND catid IN ($catids_str)".$thumb; } else { $sql = "status=99 AND catid='$catid'".$thumb; } } $order = $data['order']; $return = $this->db->select($sql, '*', $data['limit'], $order, '', 'id'); //调用副表的数据 if (isset($data['moreinfo']) && intval($data['moreinfo']) == 1) { $ids = array(); foreach ($return as $v) { if (isset($v['id']) && !emptyempty($v['id'])) { $ids[] = $v['id']; } else { continue; } } if (!emptyempty($ids)) { $this->db->table_name = $this->db->table_name.'_data'; $ids = implode('\',\'', $ids); $r = $this->db->select("`id` IN ('$ids')", '*', '', '', '', 'id'); if (!emptyempty($r)) { foreach ($r as $k=>$v) { if (isset($return[$k])) $return[$k] = array_merge($v, $return[$k]); } } } } return $return; } 修改为: /** * 列表页标签 * @param $data */ public function lists($data) { $catid = intval($data['catid']); if(isset($data['where'])) { $sql = $data['where']; } else { $thumb = intval($data['thumb']) ? " AND thumb != ''" : ''; if(!emptyempty($catid)) { if(!$this->set_modelid($catid)) return false; if($this->category[$catid]['child']) { $catids_str = $this->category[$catid]['arrchildid']; $pos = strpos($catids_str,',')+1; $catids_str = substr($catids_str, $pos); $sql = "status=99 AND catid IN ($catids_str)".$thumb; } else { $sql = "status=99 AND catid='$catid'".$thumb; } } else { $sql = "status=99".$thumb; } } $order = $data['order']; $return = $this->db->select($sql, '*', $data['limit'], $order, '', 'id'); //调用副表的数据 if (isset($data['moreinfo']) && intval($data['moreinfo']) == 1) { $ids = array(); foreach ($return as $v) { if (isset($v['id']) && !emptyempty($v['id'])) { $ids[] = $v['id']; } else { continue; } } if (!emptyempty($ids)) { $this->db->table_name = $this->db->table_name.'_data'; $ids = implode('\',\'', $ids); $r = $this->db->select("`id` IN ('$ids')", '*', '', '', '', 'id'); if (!emptyempty($r)) { foreach ($r as $k=>$v) { if (isset($return[$k])) $return[$k] = array_merge($v, $return[$k]); } } } } return $return; } 修改代码后,即能调取全站最新文章。 调用方法:{pc:content action="lists" num="10" order="id DESC" cache="3600"}
2014年02月13日
208 阅读
0 评论
0 点赞
1
...
16
17
18
...
61