Wait until jQuery is loaded before making clicky table

This commit is contained in:
ruan 2015-10-06 12:03:38 +02:00
parent ec15770339
commit 4c2844e17e
2 changed files with 10 additions and 2 deletions

View File

@ -28,6 +28,14 @@ function navbar($links) {
<!-- CSS -->
<link href="includes/css/bootstrap.min.css" rel="stylesheet">
<link href="includes/css/custom.css" rel="stylesheet">
<script type="text/javascript">
function withjQuery(f) {
if (window.jQuery) f();
else window.setTimeout(function () {
withjQuery(f);
}, 100);
}
</script>
</head>
<header class="navbar navbar-default navbar-static-top" role="banner">

View File

@ -361,7 +361,7 @@ class Page {
public function table_end($clicky = true) {
echo '</table>';
if ($clicky) {
echo "<script type=\"text/javascript\">$('tr').click(function(){window.location=$(this).find('a').attr('href');}).hover(function(){\$(this).toggleClass('hover');});</script>";
echo "<script type=\"text/javascript\">withjQuery(function(){ $('tr').click(function(){window.location=$(this).find('a').attr('href');}).hover(function(){\$(this).toggleClass('hover');}); });</script>";
}
}
@ -376,6 +376,6 @@ class Page {
public function active($row, $column = "active") {
$active = $row[$column];
return $active === "1" || $active === 1 || $active === true;
return $active === "1" || $active === 1 || $active === true;
}
}