起初我以为按钮代码本身是错误的,但它在 Codepen 上可以正常工作。查看差异:
CodePen http://codepen.io/Bogette/pen/QxdJgP
WP http://testnewbogetterihtnow.000webhostapp.com
在 Wordpress 中,按钮有一个生涩的悬停动画。悬停时也不会改变文本的颜色,尽管它是拼写出来的。
需要你的帮助。原因?我拼错了简码吗?
短代码:
function text_button() {
return '
<style type="text/css">
.button {
position: absolute;
left: 0;
top: 0;
border: 1px solid #fff;
border-radius: 30px;
background-color: transparent;
-webkit-transition: all 500ms ease, background-color 500ms ease;
transition: all 500ms ease, background-color 500ms ease;
}
.button:hover {
background-image: -webkit-linear-gradient(270deg, #fff, #fff);
background-image: linear-gradient(180deg, #fff, #fff);
-webkit-transform: translate(0px, -10px);
-ms-transform: translate(0px, -10px);
transform: translate(0px, -10px);
color: #000;
}
</style>
<html>
<title>Spectacular Project</title>
<meta content="width=device-width, initial-scale=1"name="viewport"/>
<meta content="Bogette" name="button"/>
<link href="https://uploads-ssl.webflow.com/5ad2f0250e93f375ebdb98dc/css/bogdans-spectacular-project-1a670d.webflow.f1a16b2d4.css" rel="stylesheet" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js" type="text/javascript"></script><script type="text/javascript">WebFont.load({ google: { families: ["Oswald:200,300,400,500,600,700"] }});
</script>
<script type="text/javascript">!function(o,c){var n=c.documentElement,t=" w-mod-";n.className+=t+"js",("ontouchstart"in o||o.DocumentTouch&&c instanceof DocumentTouch)&&(n.className+=t+"touch")}(window,document);
</script>
<link href="https://daks2k3a4ib2z.cloudfront.net/img/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
<link href="https://daks2k3a4ib2z.cloudfront.net/img/webclip.png" rel="apple-touch-icon"/>
</head>
<body class="body">
<a href="#" class="button w-button">Button Text</a>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" type="text/javascript" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous">
</script>
</body>
</html>
';
}
add_shortcode('tb', 'text_button');