我正在使用 jQuery 滑块。我在客户端有效地使用了它,但是在服务器端运行时遇到了问题。
我在客户端运行的代码是:
var a = jQuery.noConflict();
j(document).ready(function () {
a('#sliderFrame').nivoSlider();
});
它昨天工作得很好,但今天它不工作了。任何帮助都会很棒。
jQuery(document).ready(function($) {
// Stuff to do as soon as the DOM is ready.
//Use $() w/o colliding with other libs;
$('#sliderFrame').nivoSlider();
});
您不需要创建另一个对象a
或j
使用 jquery。即使您有多个 javascript 库,上述方法也可以安全使用。
注意:在使用nivoSlider()
方法之前,请确保您已包含必要的nivoSlider 插件 js 文件,如下所示...
<script src="path/to/jquery.nivo.slider.pack.js" type="text/javascript"></script>
请尝试以下代码
var a = jQuery.noConflict();
a(document).ready(function () {
a('#sliderFrame').nivoSlider();
});