Skip to content

Commit

Permalink
加入平滑滚动
Browse files Browse the repository at this point in the history
  • Loading branch information
mumbaicat committed Jan 15, 2018
1 parent 0016456 commit 141174a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mumbaicat/apidoc/ApiDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private function parse($data)
* @return string html代码
*/
private function makeTable($data){
$return = '<div id="api.php/index/index/list" class="api-main">
$return = '<div id="'.base64_encode($data['requestUrl']).'" class="api-main">
<div class="title">'.$data['methodName'].'</div>
<div class="body">
<table class="layui-table">
Expand Down Expand Up @@ -229,7 +229,7 @@ private function makeRight($rightList){
$return .= '<blockquote class="layui-elem-quote layui-quote-nm right-item-title">'.$d.'</blockquote>
<ul class="right-item">';
foreach($file as $one){
$return .= '<li><a href="#'.$one['requestUrl'].'"><cite>'.$one['methodName'].'</cite><em>'.$one['requestUrl'].'</em></a></li>';
$return .= '<li><a href="#'.base64_encode($one['requestUrl']).'"><cite>'.$one['methodName'].'</cite><em>'.$one['requestUrl'].'</em></a></li>';
}
$return .= '</ul>';
}
Expand Down Expand Up @@ -264,7 +264,7 @@ public function make($fetch=false)
$tempData = str_replace('{main}',$inputData,$tempData);
$tempData = str_replace('{right}',$this->makeRight($rightList),$tempData);
$tempData = str_replace('{date}',date('Y-m-d H:i:s'),$tempData);
if($fetch){
if($fetch==false){
file_put_contents($this->savePath.$this->name.'.html',$tempData);
}else{
return $tempData;
Expand Down
12 changes: 12 additions & 0 deletions src/mumbaicat/apidoc/temp.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@
</div>
</body>
<script type="text/javascript">
$(document).ready(function() {
$(".right-item a").click(function() {
$("html,body").animate({
scrollTop: $($(this).attr("href")).offset().top + "px"
},
{
duration: 500,
easing: "swing"
});
return false;
});
});
function request(pmethod,purl,pdata=null){
$.ajax({
type:pmethod,
Expand Down

0 comments on commit 141174a

Please sign in to comment.