Home  >  Article  >  Web Front-end  >  jQuery lower right corner rotating ring menu special effect code_javascript skills

jQuery lower right corner rotating ring menu special effect code_javascript skills

WBOY
WBOYOriginal
2016-05-16 15:46:061004browse

jquery implements the special effect code of the rotating ring menu in the lower right corner, which is fixed at the lower right corner of the page. When the user clicks the main menu button, the submenu items will rotate into the page in a ring, and use animate.css to create animation effects.
The rendering is as follows:

Online preview Click to download

html code:

<div class="htmleaf-container">
 <div id='ss_menu'>
  <div>
  <i class="fa fa-qq"></i>
  </div>
  <div>
  <i class="fa fa-weibo"></i>
  </div>
  <div>
  <i class="fa fa-weixin"></i>
  </div>
  <div>
  <i class="fa fa-renren"></i>
  </div>
  <div class='menu'>
  <div class='share' id='ss_toggle' data-rot=''>
   <div class='circle'></div>
   <div class='bar'></div>
  </div>
  </div>
 </div>
</div>

js code:

$(document).ready(function (ev) {
 var toggle = $('#ss_toggle');
 var menu = $('#ss_menu');
 var rot;
 $('#ss_toggle').on('click', function (ev) {
  rot = parseInt($(this).data('rot')) - 180;
  menu.css('transform', 'rotate(' + rot + 'deg)');
  menu.css('webkitTransform', 'rotate(' + rot + 'deg)');
  if (rot / 180 % 2 == 0) {
   toggle.parent().addClass('ss_active');
   toggle.addClass('close');
  } else {
   toggle.parent().removeClass('ss_active');
   toggle.removeClass('close');
  }
  $(this).data('rot', rot);
 });
 menu.on('transitionend webkitTransitionEnd oTransitionEnd', function () {
  if (rot / 180 % 2 == 0) {
   $('#ss_menu div i').addClass('ss_animate');
  } else {
   $('#ss_menu div i').removeClass('ss_animate');
  }
 });
});

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn