ruby on rails 3 - Bxslider not working -
i'm implementing bxslider in rails app, i'm having trouble making work, far issue transition not working instead appear each 1 below other. can point me i'm missing?
html:
<!--bxslider--> <ul class="bxslider"> <li> <%= image_tag "header1.png" %> <div class="row text-center"> <div class="span10 offset1"> <h1>tittle one</h1><br /> <a class="btn-main" href="about.html">learn more</a> </div> </div> </li> <li> <%= image_tag "header2.png" %> <div class="row text-center"> <div class="span10 offset1"> <h1>tittle 2</h1><br /> <a class="btn-main" href="about.html">learn more</a> </div> </div> </li> </ul>
css:
/** reset , layout ===================================*/ .bx-wrapper { position: relative; margin: 0 auto 60px; padding: 0; *zoom: 1; } .bx-wrapper img { max-width: 100%; display: block; } /** theme ===================================*/ .bx-wrapper .bx-viewport { -moz-box-shadow: 0 0 5px #ccc; -webkit-box-shadow: 0 0 5px #ccc; box-shadow: 0 0 5px #ccc; border: solid #fff 5px; left: -5px; background: #fff; } .bx-wrapper .bx-pager, .bx-wrapper .bx-controls-auto { position: absolute; bottom: -30px; width: 100%; } /* loader */ .bx-wrapper .bx-loading { min-height: 50px; background: url(bx_loader.gif) center center no-repeat #fff; height: 100%; width: 100%; position: absolute; top: 0; left: 0; z-index: 2000; } /* pager */ .bx-wrapper .bx-pager { text-align: center; font-size: .85em; font-family: arial; font-weight: bold; color: #666; padding-top: 20px; } .bx-wrapper .bx-pager .bx-pager-item, .bx-wrapper .bx-controls-auto .bx-controls-auto-item { display: inline-block; *zoom: 1; *display: inline; } .bx-wrapper .bx-pager.bx-default-pager { background: #666; text-indent: -9999px; display: block; width: 10px; height: 10px; margin: 0 5px; outline: 0; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } .bx-wrapper .bx-pager.bx-default-pager a:hover, .bx-wrapper .bx-pager.bx-default-pager a.active { background: #000; } /* direction controls (next / prev) */ .bx-wrapper .bx-prev { left: 10px; background: url(controls.png) no-repeat 0 -32px; } .bx-wrapper .bx-next { right: 10px; background: url(controls.png) no-repeat -43px -32px; } .bx-wrapper .bx-prev:hover { background-position: 0 0; } .bx-wrapper .bx-next:hover { background-position: -43px 0; } .bx-wrapper .bx-controls-direction { position: absolute; top: 50%; margin-top: -16px; outline: 0; width: 32px; height: 32px; text-indent: -9999px; z-index: 9999; } .bx-wrapper .bx-controls-direction a.disabled { display: none; } /* auto controls (start / stop) */ .bx-wrapper .bx-controls-auto { text-align: center; } .bx-wrapper .bx-controls-auto .bx-start { display: block; text-indent: -9999px; width: 10px; height: 11px; outline: 0; background: url(controls.png) -86px -11px no-repeat; margin: 0 3px; } .bx-wrapper .bx-controls-auto .bx-start:hover, .bx-wrapper .bx-controls-auto .bx-start.active { background-position: -86px 0; } .bx-wrapper .bx-controls-auto .bx-stop { display: block; text-indent: -9999px; width: 9px; height: 11px; outline: 0; background: url(controls.png) -86px -44px no-repeat; margin: 0 3px; } .bx-wrapper .bx-controls-auto .bx-stop:hover, .bx-wrapper .bx-controls-auto .bx-stop.active { background-position: -86px -33px; } /* pager auto-controls hybrid layout */ .bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-pager { text-align: left; width: 80%; } .bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-controls-auto { right: 0; width: 35px; } /* image captions */ .bx-wrapper .bx-caption { position: absolute; bottom: 0; left: 0; background: #666\9; background: rgba(80, 80, 80, 0.75); width: 100%; } .bx-wrapper .bx-caption span { color: #fff; font-family: arial; display: block; font-size: .85em; padding: 10px; }
js:
<script> $(document).ready(function(){ $('.bxslider').bxslider({ mode: 'fade', auto: true, pause: 4000, autohover: false, touchenabled: true, adaptiveheight: false, autocontrols: false }); }); </script>
error:
uncaught typeerror: object [object object] has no method 'bxslider'
i think had issue not referencing correct library bxslider.
i pasted code in fiddle. made couple of changes in html(img tags) ruby-on-rails code pasted css , jquery. presto worked. check out.
html
<ul class="bxslider"> <li> <img src="http://lorempixel.com/400/200/sports" /> <div class="row text-center"> <div class="span10 offset1"> <h1>tittle one:sports</h1><br /> <a class="btn-main" href="about.html">learn more</a> </div> </div> </li> <li> <img src="http://lorempixel.com/400/200/animals" /> <div class="row text-center"> <div class="span10 offset1"> <h1>tittle 2:animals</h1><br /> <a class="btn-main" href="about.html">learn more</a> </div> </div> </li> </ul>
Comments
Post a Comment