(function($){ $.fn.rotate_box = function(){ var elm = $(this), elm_in = $('.inner', this), btn = $('.face, .back', elm), deg = 0, turn = false, turn_cls = 'reverse'; var rotate_anm = function(){ elm_in.css({ 'transform' : 'rotateY(' + deg * -2 + 'deg)' }); }; var rotate = function(){ setTimeout(function(){ rotate_anm(); if( deg == 45 ){ if( turn === false ){ elm.addClass(turn_cls); } else { elm.re