handsome美化教程

简介

之前购买了handsome主题,本人还是挺喜欢的,收集了一些美化代码,整理一下,留给那些有需要的小伙伴

点击特效

两个点击特效均放置于usr/themes/handsome/component/footer.php文件的<?php $this->options->bottomHtml(); ?>之上

富强、爱国等(随机字符)

  1. <!--爱国、富强等点击特效-->
  2. <script type="text/javascript">
  3. var a_idx = 0;
  4. jQuery(document).ready(function ($) {
  5. $("body").click(function (e) {
  6. var a = new Array("富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善");
  7. var $i = $("<span/>").text(a[a_idx]);
  8. a_idx = (a_idx + 1) % a.length;
  9. var x = e.pageX, y = e.pageY;
  10. $i.css({
  11. "z-index": 999999999999999999999999999999999999999999999999999999999999999999999,
  12. "top": y - 20,
  13. "left": x,
  14. "position": "absolute",
  15. "font-weight": "bold",
  16. "color": "#ff6651"
  17. });
  18. $("body").append($i);
  19. $i.animate({ "top": y - 180, "opacity": 0 }, 1500, function () {
  20. $i.remove();
  21. });
  22. });
  23. });
  24. </script>

随机颜色小爱心点击特效

  1. <!--随机颜色小爱心点击特效-->
  2. <script type="text/javascript">
  3. !function (e, t, a) {
  4. function r() {
  5. for (var e = 0; e < s.length; e++) s[e].alpha <= 0 ? (t.body.removeChild(s[e].el), s.splice(e, 1)) : (s[e].y--, s[e].scale += .004, s[e].alpha -= .013, s[e].el.style.cssText = "left:" + s[e].x + "px;top:" + s[e].y + "px;opacity:" + s[e].alpha + ";transform:scale(" + s[e].scale + "," + s[e].scale + ") rotate(45deg);background:" + s[e].color + ";z-index:99999");
  6. requestAnimationFrame(r)
  7. }
  8. function n() {
  9. var t = "function" == typeof e.onclick && e.onclick;
  10. e.onclick = function (e) {
  11. t && t(), o(e)
  12. }
  13. }
  14. function o(e) {
  15. var a = t.createElement("div");
  16. a.className = "heart", s.push({
  17. el: a,
  18. x: e.clientX - 5,
  19. y: e.clientY - 5,
  20. scale: 1,
  21. alpha: 1,
  22. color: c()
  23. }), t.body.appendChild(a)
  24. }
  25. function i(e) {
  26. var a = t.createElement("style");
  27. a.type = "text/css";
  28. try {
  29. a.appendChild(t.createTextNode(e))
  30. } catch (t) {
  31. a.styleSheet.cssText = e
  32. }
  33. t.getElementsByTagName("head")[0].appendChild(a)
  34. }
  35. function c() {
  36. return "rgb(" + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + ")"
  37. }
  38. var s = [];
  39. e.requestAnimationFrame = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame || function (e) {
  40. setTimeout(e, 1e3 / 60)
  41. }, i(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"), n(), r()
  42. }(window, document);
  43. </script>

文章声明代码

放置于usr/themes/handsome/post.php文件的<?php if ($this->options->adContentPost != ""): ?>上面,觉得距离比较远可以自行删除

  1. <div class="entry-content l-h-2x">
  2. <div class="tip inlineBlock info">
  3. <?php _e('文章名:'); ?><?php $this->title()?>
  4. <br>
  5. <br>
  6. 文章链接:<a href="<?php $this->permalink() ?>"><?php $this->permalink() ?></a>
  7. <br>
  8. <br>
  9. 联系方式:rateldev@qq.com
  10. <br>
  11. <br>
  12. 除特别注明外,文章均为<a rel="external nofollow" target="_blank" href="http://www.ratelsx.com/">Ratel</a>原创,转载时请注明本文出处及文章链接
  13. </div>
  14. </div>

文章版式圆角化

以下代码都放置于后台→外观→开发者模式→自定义 css

  1. /*
  2. 圆角大小可修改15px数值
  3. 首页文章版式圆角化
  4. */
  5. .panel {
  6. border: none;
  7. border-radius: 15px;
  8. }
  9. .panel-small {
  10. border: none;
  11. border-radius: 15px;
  12. }
  13. .item-thumb {
  14. border-radius: 15px;
  15. }

头像获取焦点放大

  1. /*
  2. 转动快慢和头像大小自行修改数值
  3. 首页头像自动旋转
  4. */
  5. .thumb-lg {
  6. width: 130px;
  7. }
  8. .avatar {
  9. -webkit-transition: 0.4s;
  10. -webkit-transition: -webkit-transform 0.4s ease-out;
  11. transition: transform 0.4s ease-out;
  12. -moz-transition: -moz-transform 0.4s ease-out;
  13. }
  14. .avatar:hover {
  15. transform: rotateZ(360deg);
  16. -webkit-transform: rotateZ(360deg);
  17. -moz-transform: rotateZ(360deg);
  18. }
  19. #aside-user span.avatar {
  20. animation-timing-function: cubic-bezier(0, 0, .07, 1) !important;
  21. border: 0 solid
  22. }
  23. #aside-user span.avatar:hover {
  24. transform: rotate(360deg) scale(1.2);
  25. border-width: 5px;
  26. animation: avatar .5s
  27. }

头像自动旋转

  1. /*
  2. 旋转速度请修改3s数值
  3. 首页自动旋转
  4. */
  5. .thumb-lg {
  6. width: 130px;
  7. }
  8. @-webkit-keyframes rotation {
  9. from {
  10. -webkit-transform: rotate(0deg);
  11. }
  12. to {
  13. -webkit-transform: rotate(360deg);
  14. }
  15. }
  16. .img-full {
  17. -webkit-transform: rotate(360deg);
  18. animation: rotation 3s linear infinite;
  19. -moz-animation: rotation 3s linear infinite;
  20. -webkit-animation: rotation 3s linear infinite;
  21. -o-animation: rotation 3s linear infinite;
  22. }

文章版式阴影化

  1. /*
  2. 阴影颜色修改rgba后面的值
  3. panel阴影
  4. */
  5. .panel {
  6. box-shadow: 1px 1px 5px 5px rgba(255, 112, 173, 0.35);
  7. -moz-box-shadow: 1px 1px 5px 5px rgba(255, 112, 173, 0.35);
  8. }
  9. .panel:hover {
  10. box-shadow: 1px 1px 5px 5px rgba(255, 112, 173, 0.35);
  11. -moz-box-shadow: 1px 1px 5px 5px rgba(255, 112, 173, 0.35);
  12. }
  13. .panel-small {
  14. box-shadow: 1px 1px 5px 5px rgba(255, 112, 173, 0.35);
  15. -moz-box-shadow: 1px 1px 5px 5px rgba(255, 112, 173, 0.35);
  16. }
  17. .panel-small:hover {
  18. box-shadow: 1px 1px 5px 5px rgba(255, 112, 173, 0.35);
  19. -moz-box-shadow: 1px 1px 5px 5px rgba(255, 112, 173, 0.35);
  20. }
  21. /*
  22. 如果也想使盒子四周也有阴影,加上以下代码
  23. */
  24. .app.container {
  25. box-shadow: 0 0 30px rgba(255, 112, 173, 0.35);
  26. }

文章标题居中

  1. .panel h2 {
  2. text-align: center;
  3. }
  4. .post-item-foot-icon {
  5. text-align: center;
  6. }

自定义右侧滚动条

  1. /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
  2. ::-webkit-scrollbar {
  3. width: 3px;
  4. height: 16px;
  5. background-color: rgba(255, 255, 255, 0);
  6. }
  7. /*定义滚动条轨道 内阴影+圆角*/
  8. ::-webkit-scrollbar-track {
  9. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  10. border-radius: 10px;
  11. background-color: rgba(255, 255, 255, 0);
  12. }
  13. /*定义滑块 内阴影+圆角*/
  14. ::-webkit-scrollbar-thumb {
  15. border-radius: 10px;
  16. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
  17. background-color: #555;
  18. }

图片抖动效果

  1. /*图片抖动效果*/
  2. img:hover {
  3. -webkit-animation: sucaijiayuan 1s .1s ease both;
  4. -moz-animation: tada 1s .1s ease both;
  5. }
  6. @-webkit-keyframes sucaijiayuan {
  7. 0% {
  8. -webkit-transform: scale(1)
  9. }
  10. 10%, 20% {
  11. -webkit-transform: scale(0.8) rotate(-2deg)
  12. }
  13. 30%, 50%, 70%, 90% {
  14. -webkit-transform: scale(1.1) rotate(2deg)
  15. }
  16. 40%, 60%, 80% {
  17. -webkit-transform: scale(1.1) rotate(-2deg)
  18. }
  19. 100% {
  20. -webkit-transform: scale(1) rotate(0)
  21. }
  22. }

输入框气泡特效

首先下载commentTyping.js文件,放到主题,位置任意,然后找到footer.php文件,</body>之前添加<script type=”text/javascript” src="这里放你的路径"></script>

下载地址

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
2 条回复 A文章作者 M管理员
欢迎您,新朋友,感谢参与互动!
  1. 核心价值观,我还专门发了一篇文章!哈哈!

    • 哈哈

个人中心
购物车
优惠劵
今日签到
私信列表
搜索