I have developed some script for detecting when user scroll down a page, and it works on simple script and doesn’t work now if I use CodeIgniter. I have put the library into root directory of project. There is some code from view:
UPDATED: full code of the page
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" />
<link href="/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<style type="text/css">
body {
padding-top: 60px;
padding-bottom: 40px;
}
.sidebar-nav {
padding: 9px 0;
}
</style>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery.jeditable.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function()
{
$(window).scroll(function()
{
if ($(window).scrollTop() == $(document).height() - $(window).height())
{
alert('1');
}
});
});
</script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="#">Translation project</a>
<div class="btn-group pull-right">
<a class="btn btn-primary" href="<?=$fb_url;?>">
<i class="icon-user"></i>
<?=$user_title;?>
</a>
<ul class="dropdown-menu">
<li><a href="#">Profile</a></li>
<li class="divider"></li>
<li><a href="#">Sign Out</a></li>
</ul>
</div>
<div class="nav-collapse">
<ul class="nav">
<li><a href="<?php echo $base_url.'view_testing' ?>">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span3">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Languages</li>
<?php
foreach ($languages as $language)
{
$url=$base_url.'language_testing/'.$language['language_code'];
if ($language['language_value']==$current_language['language_value'])
{
echo "<li class='active'><a href='{$url}'>".$language['language_value']." (".
$language['translated']."/".$total_labels_number.")</a></li>";
}
else
{
echo "<li><a href='{$url}'>".$language['language_value']." (".
$language['translated']."/".$total_labels_number.")</a></li>";
}
}
?>
</ul>
</div>
</div><!--/span-->
<div class="span9">
<div class="hero-unit-little">
<h2>
<?php
echo 'Translations for '.$current_language['language_value'].' ('.
$current_language['translated'].'/'.$total_labels_number.')';
?>
</h2>
</div>
<table>
<tbody>
<?php
foreach ($records as $record) {
echo "<tr style='border-bottom: 1px dotted silver;'>";
echo "<td width='500'>" . strip_tags($record['language_value']) . "</td>";
if ($record['approved_translation'])
{
echo "<td class ='output' id='".$record['index']."' style='vertical-align:middle' width='200'>" . "<b>".$record['approved_translation']['language_value'].
"</b>"."</td>";
}
else
{
echo "<td class = 'output' id='".$record['index']."' style='vertical-align:middle' width='200'>" . "<b>Not translated</b>" . "</td>";
}
echo '</tr>';
}
?>
</tbody>
</table>
<br/>
</div>
</div>
</body>
</html>
But now it doesn’t respond to scrolling. Please, tell me why?
I’d try inserting this before even your
$(document).ready():If you see this dialog, it means the jQuery library failed to load (the path doesn’t look correct to me), so you’ll need to fix the path. EDIT: If it’s in the site root, just add a forward slash –
/– to the beginning of the current URL.