开发者

Change Background position onClick

开发者 https://www.devze.com 2023-01-18 00:12 出处:网络
I would like to change t开发者_StackOverflowhe background position of one link when another link is clicked.I want this to change:

I would like to change t开发者_StackOverflowhe background position of one link when another link is clicked. I want this to change:

<a class="fast btn-slide" href="#"></a>


Add an onclick event handler to the link and change/add a predefined class to the link


<style type="text/css">
.ThirdClassName { position:absolute;left:25px;top:25px; }
</style>

<a class="fast btn-slide" href="#" onclick="this.className += ' ThirdClassName'"></a>

This adds a class behind the others that are currently defined

0

精彩评论

暂无评论...
验证码 换一张
取 消