在任何人跳到我身上之前。我是网络管理员(CCNP) IA/CND (CISSP)类型。我声明这一点是为了让每个人都知道我来自哪里。这可能是最简单的问题,但是如何将onclick添加到下面列出的按钮并让它转到say...ancestry.com。我想我也会让其他按钮转到其他网站。建立我的第一个网站,家庭圣诞礼物,边学边学。我找到了一个模板站点,并且玩得很开心。
/* Try This*/
$(".hover").mouseleave(
function() {
$(this).removeClass("hover");
}
);@import url(https://fonts.googleapis.com/css?family=Raleway:500);
.snip1564 {
background-color: #ffffff;
border: none;
border-bottom: 6px solid #029ebe;
border-top: 6px solid #029ebe;
color: #555;
cursor: pointer;
display: inline-block;
font-family: 'Raleway', Arial, sans-serif;
font-size: 14px;
font-weight: 500;
height: 46px;
letter-spacing: 3px;
line-height: 34px;
margin: 15px 40px;
outline: none;
padding: 0 10px;
position: relative;
text-transform: uppercase;
}
.snip1564:before,
.snip1564:after {
box-sizing: border-box;
-webkit-transition: all 0.3s;
transition: all 0.3s;
background-color: #ffffff;
border-radius: 50%;
top: -6px;
content: "";
height: 46px;
position: absolute;
width: 46px;
border: 6px solid #ddd;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
z-index: -1;
}
.snip1564:before {
right: -23px;
border-left-color: #029ebe;
border-bottom-color: #029ebe;
}
.snip1564:after {
left: -23px;
border-right-color: #029ebe;
border-top-color: #029ebe;
}
.snip1564:hover,
.snip1564.hover {
background-color: #ffffff;
}
.snip1564:hover:before,
.snip1564.hover:before,
.snip1564:hover:after,
.snip1564.hover:after {
-webkit-transform: rotate(225deg);
transform: rotate(225deg);
}
/* Try This*/
body {
background-color: #212121;
padding: 50px 0;
text-align: center;
}<button class="snip1564">ancestry.com</button>
<button class="snip1564 hover">Facebook</button>
<button class="snip1564">Youtube</button>
<button class="snip1564">Send a happy Holidays greeting</button>
发布于 2016-12-02 03:55:57
你可以通过两种方式来实现,制作一个看起来像一个按钮的超链接,或者制作一个带有点击处理程序的按钮来改变页面。
您将需要一些css来定义按钮的外观并将其分配给一个类
<a href='http://www.ancestry.com' class='button'>Ancestry</a>或
<button class="snip1564" onclick='window.location="http://www.ancestry.com"'>
ancestry.com
</button>编辑:这是一个小提琴https://jsfiddle.net/qa0kco9b/1/
https://stackoverflow.com/questions/40919189
复制相似问题