Today with Turn.js to do book page turn effect encountered problems:
Picture Path always error
It's been tuned for a day.
I use the thinkphp, the others do not know is not the same
Two places to change:
1. Background detection Address
Note the place: 1. Address to be completely
2.js data to be in JSON format
$more = M (' File ')->where (array (' id ' = $id))->find (); $more 1 = Json_decode ($more [' More '],true); foreach ($more 1 as $k = + $v) { /*weburl is the site domain name savepath is the image storage address */$v [' path '] = C (' Weburl '). ' /'. $v [' Savepath ']; $type = End (Explode ('. ', $v [' name ']); if (' jpg ' = = $type) { $more 2[] = $v; }} $more [' more2 '] = $more 2; $more [' more3 '] = Json_encode ($more 2); $this->assign (' more ', $more);
2. Front-desk JS to form the required JSON data to the method to pass
< {$more. more3} > ; var savepath = new Array (); var I=1; $.each (more, function (e,v) { savepath[i] = V.path; i++; });
missing:function (event, pages) { //Add pages aren ' t in the magazine< page S. length; i++) { addPage (Pages[i], $ (this), Savepath);} }
3.Magazine.js to change
function AddPage (page, book,data) function loadPage (page, pageelement,data) There are several places to change the image path Img.attr (' src ', data[page]); /img.attr (' src ', ' pages/' + page + '. jpg ');
Turn.js Book page Turn effect