使用three.js创建flipboard

时间:2014-06-25 11:45:54

标签: javascript jquery three.js flipboard

我是three.js的新手,并在一周前开始研究它。 这真的是一个很好的图书馆但是我是新手,我的问题是我想使用http://www.creaktif.com/使用的这个库制作一个fliboard。 请给我一些简单的想法,了解如何用three.js做这种事情。

1 个答案:

答案 0 :(得分:0)

尝试这样的事情

 $(document).ready(function() { 

        $('.box').click(function(e){

            if( $('div').hasClass('overlay')==false ){

            //event.preventDefault();
            var $box = $(this);

            $('<div class="overlay"></div>').prependTo($box);

            var $overlay = $('.overlay');

            $overlay.css( {
                           'position'       : 'absolute',
                           'background-color'   : 'white',
                           'width'              : $box.outerWidth(true),
                           'height'     : $box.outerHeight(true),
                           'left'       : $box.offset().left,
                           'top'        : $box.offset().top,
                           'z-index'        : 99999999
            });                                       
            //$($placeholder).insertAfter('.box');  

            $overlay.animate({
                    width: $(document).width(),
                    height: $(document).height(),
                    left: '0px',
                    top: '0px'
                }, 500, function() {
                    //reset the overlay
                    $overlay.css({'width': ''});
                    $overlay.css({'height': '1500px'});
                    //ajax    
                    $.ajax({  
                        type: "POST",  
                        url: "../ajax/get_event.php",  
                        data: "firstname=clint&lastname=eastwood",  
                        success: function(resp){  
                            // we have the response  
                            $overlay.html(resp);
                            $('.window').fadeIn(200);
                        },  
                        error: function(e){  
                            alert('Error: ' + e);  
                        }  
                    });
            });

            }else{
                //click only on overlay to exit
                var $target = $(e.target);    
                if ( $target.is('.overlay') ) {
                   $('.overlay').remove();
                }
            }  

        });//end box click

    });//end of jquery
    </script>