I do have a requirement to show the pace.js progress on page load in td tag rather showing on the middle of webpage.
My HTML :
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/pace.js"/>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/themes/green/pace-theme-center-circle.min.css">
</head>
<body>
<table border="1">
<tr>
<th>Channel</th>
<th>Health</th>
<th>Action</th>
</tr>
<tr>
<td>Mobile</td>
<td class="tdcolor">
<select >
<option value="0">Select</option>
<option value="1">Green</option>
<option value="2">Red</option>
<option value="3">Amber</option>
</select>
</td>
<td> <!--show progress bar here></td>
</tr>
</table>
</body>
</html>
Is it possible to show the progress using pace.js in third td cell ? The reason I'm using pace is because of nil configuration. If it is not possible, could you please guide me with ajax/jquery?
Many Thanks in advance.
You can do that, but it will take a little bit of work. You'll need to modify the
pace.jssource file, which means you'll need to host or provide your own (modified) copy of it.The changes you'll need to make are in the
Bar.prototype.getElementmethod; see the modified function below for an example. You can copy that code exactly, or modify it if you want.Those changes basically redirect the
targetElementvariable to point to yourtdcell, and also set the progress indicator to use relative positioning so it displays inside the cell.I can't provide a working example here because the entire
pace.jsfile is too large, but if you replace the standardBar.prototype.getElementwith the one above, it will insert the progress indicator into thattdcell.Pace.js License: (included for attribution)
Copyright (c) 2013 HubSpot, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.