html - Using Tether Javascript Library causing exception -


i working on new website , want include footer @ bottom of container div.

i found javascript library called tether (http://github.hubspot.com/tether/) having problem implementation.

below html code

<html>     <head>         <title>bug reporting</title>         <link href="stylesheet.css" type="text/css" rel="stylesheet" />         <script src="includes/jquery.js"></script>         <script src="includes/tether/tether.js"></script>         <script>             $(document).ready(function()             {                 new tether({                     element: '.footer',                     target: '.container',                     attachment: 'top left',                     targetattachment: 'bottom left'                 });             });         </script>     </head>     <body>         <div class="container">             <header>                 body             </header>              <div id="content">                 content<br />             </div>              <div class="footer1">                 footer             </div>         </div>     </body> </html> 

below stylesheet

html, body {     font-family: arial;     margin: 0;     padding: 0; }  header {     background-color: red;     width: 100%;     height: 80px; }  .container {     background-color: yellow;     height: calc(100% - 80px);     width: 100%; }  #content {     background-color: blue;     width: 1024px;     margin-left: auto;     margin-right: auto;     height: auto; }  .footer1 {     position: absolute;     background-color: green;     width: 100%;     height: 80px; } 

the problem when load page exception within tether library

uncaught typeerror: cannot read property 'classlist' of null

thanks can provide.

tether's options define element , target being dom or jquery element (in quite loose sense of word), not string.

you need pass jquery object tether, this:

$(document).ready(function() {     new tether({         element: $('.footer'),         target: $('.container'),         attachment: 'top left',         targetattachment: 'bottom left'     }); }); 

also make sure elements on page when initialise tether instance.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -