How to increase the size of the "Share" buttons using the Yandex / Share service ?
- If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky β¦
3 answers
UPD. Thanks to EatMyDust for commenting on the answer. Investigated the issue in more detail.
Yandex offers 4 appearance for the block "Share". The fourth of them - with buttons of small size, so it is interesting to increase only the first three.
I propose a variant of the styles for buttons with a side of 32 pixels instead of 24. Basic values ββare in the comments for each line.
ya-share2__container_size_m .ya-share2__iconmust be redefined for all kinds of block.- For a block with counters, you need to add
.ya-share2__container_size_m .ya-share2__counter. - And for the menu block -
.ya-share2__container_size_m .ya-share2__icon_more:beforeand.ya-share2__container_size_m .ya-share2__popup_direction_bottom.
/* 1 */ .ya-share2__container_size_m .ya-share2__icon { height: 32px !important; /* 24px */ width: 32px !important; /* 24px */ background-size: 32px 32px !important; /* 24px 24px */ } /* 2 */ .ya-share2__container_size_m .ya-share2__counter { font-size: 14px !important; /* 12px */ padding: 8px 10px 0 10px !important; /* 5px 8px 0 8px */ } /* 3 */ .ya-share2__container_size_m .ya-share2__icon_more:before { line-height: 22px !important; /* 13px */ } .ya-share2__container_size_m .ya-share2__popup_direction_bottom { top: 36px !important; /* 28px */ } <h3>ΡΠΎΠ»ΡΠΊΠΎ ΠΈΠΊΠΎΠ½ΠΊΠΈ</h3> <div class="ya-share2" data-services="vkontakte,facebook,odnoklassniki,moimir"></div> <h3>ΡΡΡΡΡΠΈΠΊΠΈ</h3> <div class="ya-share2" data-services="vkontakte,facebook,odnoklassniki,moimir" data-counter=""></div> <h3>ΠΈΠΊΠΎΠ½ΠΊΠΈ ΠΈ ΠΌΠ΅Π½Ρ</h3> <div class="ya-share2" data-services="vkontakte,facebook,odnoklassniki,moimir" data-limit="3"></div> <script type="text/javascript" src="//yastatic.net/es5-shims/0.0.2/es5-shims.min.js" charset="utf-8"></script> <script type="text/javascript" src="//yastatic.net/share2/share.js" charset="utf-8"></script> - oneIn general, there may be .ya-share2__container_size_s with the letter "s" at the end, depending on what it has written in the script, and if it does not display all the icons at once, but icons and menus, then when you open the menu, everything will crawl away. - EatMyDust
- @EatMyDust Thanks for the comment. I studied the question more carefully and rewrote my answer. - Gleb Kemarsky pm
In general, if there is a need to visually change the block, the most appropriate way is to use the data-bare attribute, which is a sign that the loading of styles is disabled. If you add an attribute, social networks will be displayed in the form of a textual vertical list. And then on your side you can make the design as convenient. You, in fact, remain the minimum layout and access to the block API.
There is no guarantee that the style override offered by @Gleb Kemarsky will not break with the next update of the block.
A safer option seems to me to be the approach using the transform property. This approach does not depend on the internal representation of the block and, therefore, is less sensitive to updates.
.ya-share2__list { transform: translate(25%, 25%) scale(1.5); } <div class="ya-share2"></div> <script src="//yastatic.net/share2/share.js"></script> For older IEs, the zoom property can be used as a fallback.
- And for the menu block, what solution do you offer? In the current version, the contents of the drop-down list increases more than the main row of icons .. - Gleb Kemarsky
- Reinforced solution prompted by @Grey Evil - Roman Paradeev