- html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>title>
- <script src="../js/jquery-3.6.1.js">script>
- <style>
- a {
- text-decoration: none;
- background: #bfa;
- padding: 2px;
- width: 10px;
- height: 10px;
- }
-
- #sharemore b {
- padding: 2px;
- width: 10px;
- height: 10px;
- }
-
-
- .lf {
- background: deeppink;
- width: 185px;
- padding: 5px;
- text-align: center;
- }
-
-
- style>
- head>
- <body>
- <div class="lf" id="dd">
-
- <span>分享到:span>
- <a href="#" class="share_sina">😀a>
- <a href="#" class="share_qq">😈a>
- <a href="#" class="share_renren">😎a>
-
- <a href="#" class="share_kaixin" style="display: none;">🤪a>
- <a href="#" class="share_douban" style="display: none;">😰a>
-
-
- <a href="#" class="sharemore" id="sharemore">
- <b class="">▶b>
- a>
- div>
- <script>
- share();
-
- function share() {
- var isClose = true; //标识当前状态是关闭
- var $sharemore = $('#sharemore');
- var $parent = $sharemore.parent();
- //查找前面所有的兄弟---只需要钱敏的两个 发现是逆序的用 html eq等测试
- var $hida = $sharemore.prevAll('a:lt(2)');
- var $b = $sharemore.children()
- //触发事件的元素
- $sharemore.click(function() {
- if (isClose) { //关闭状态
- $parent.css('width', '250');
- $b.html('◀');
- console.log($b.val())
- $hida.show();
-
- } else { //去打开
-
- $parent.css('width', '185');
- $b.html('▶');
- $hida.hide();
- }
- isClose = !isClose;
- })
- }
- script>
- body>
- html>

