The example in this article describes the click-to-book effect code implemented by jquery. Share it with everyone for your reference, the details are as follows:
This is a self-written JS effect for flipping a book. It is implemented based on the jquery-1.4.2.min.js plug-in. It is still being improved. I hope everyone likes it. I think it is good.
The screenshot of the running effect is as follows:
The online demo address is as follows:
http://demo.jb51.net/js/2015/jquery-click-cha-page-style-codes/
The specific code is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>自写一个翻书的Js效果</title> <script type="text/javascript" language="javascript" src="jquery-1.4.2.min.js"></script> <script type="text/javascript" language="javascript"> $(function() { $("#right").click(function() { var roll = $("<div/>", { css: { position: "absolute", border: "solid 1px #999", left: "806px", top: "10px", height: "494px", width: "1px", background: "#fff url(images/eCX.png) repeat-y -200px 0px"} }).appendTo($("#book").parent()); $(roll).animate({ left: "10px", width: "398px", "background-position": "272px 0px" }, 1000, function() { $("#left").css({"background":"#fff"}); $(roll).fadeOut(300, function() { $(roll).remove(); }) }); }); }); </script> </head> <body style="padding:5px;margin:0;"> <div id="book" style="width:797px;height:494px;background:#ccc;border:solid 6px #ccc;"> <div id="left" style="width:398px;height:494px;float:left;background:url(images/PLh.png) no-repeat top left;cursor:pointer;"></div> <div id="right" style="width:398px;height:494px;float:left;background:#fff;cursor:pointer;margin-left:1px;text-align:right;"><p style="margin-top:470px;font-size:12px;color:#999;">点这翻页 </p></div> </div> </body> </html>
I hope this article will be helpful to everyone in jQuery programming.