admin管理员组文章数量:1305092
I'm pretty new with JQuery, I'm trying to get this script to work. I'm trying to create a rotator on the homepage of a clients website but I can't get it to run! I get no errors, the files are were they're supposed to be, I can't for the life of me figure out what the problem is!
Here's a snipped of the code:
<script src=".js"></script>
<script src="jquery.bxSlider.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("form#newsletter-form").submit(function () {
$.post("/newsletter.ajax.php", {
action: 'subscribe',
email: $("form#newsletter-form input#email").val()
}, function (json) {
if (json.success == true) {
$("div.form-container").empty().append("<p>Thank you for submitting your info.</p>");
} else {
alert(json.error);
}
}, 'json');
return false;
$(function () {
$('#show-options').click(function () {
$('#options').slideToggle();
$(this).toggleClass('open');
return false;
});
});
$('#slider1').bxSlider({
infiniteLoop: false,
auto: true,
pager: true
});
});
});
</script>
The slider is what I'm trying to get to run, I wonder if the problem has to do with the function above it or if there's a conflict.
Thank You.
I'm pretty new with JQuery, I'm trying to get this script to work. I'm trying to create a rotator on the homepage of a clients website but I can't get it to run! I get no errors, the files are were they're supposed to be, I can't for the life of me figure out what the problem is!
Here's a snipped of the code:
<script src="http://code.jquery./jquery-latest.js"></script>
<script src="jquery.bxSlider.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("form#newsletter-form").submit(function () {
$.post("/newsletter.ajax.php", {
action: 'subscribe',
email: $("form#newsletter-form input#email").val()
}, function (json) {
if (json.success == true) {
$("div.form-container").empty().append("<p>Thank you for submitting your info.</p>");
} else {
alert(json.error);
}
}, 'json');
return false;
$(function () {
$('#show-options').click(function () {
$('#options').slideToggle();
$(this).toggleClass('open');
return false;
});
});
$('#slider1').bxSlider({
infiniteLoop: false,
auto: true,
pager: true
});
});
});
</script>
The slider is what I'm trying to get to run, I wonder if the problem has to do with the function above it or if there's a conflict.
Thank You.
Share Improve this question edited Oct 19, 2010 at 16:59 user372551 asked Oct 19, 2010 at 16:45 CoreyCorey 211 silver badge2 bronze badges 4- This is the error I get - $("#slider1").bxSlider is not a function – Corey Commented Oct 19, 2010 at 17:00
-
None of that code after
return false
will do anything...because the function will have returned already. It should be outdented a level, and the$(function...
part in the middle isn't needed because you're already inside aready
event – Michael Haren Commented Oct 19, 2010 at 17:02 - Modified it, made it a little more simple, petconn.blackdogstaging. – Corey Commented Oct 19, 2010 at 17:09
- Hi Corey, I am having the same issue with bxSlider - will you please let me know what solution you found? Thanks! – user631143 Commented Feb 24, 2011 at 2:07
3 Answers
Reset to default 6I had this same problem, but resolved the issue by using jQuery.noConflict:
var j = jQuery.noConflict();
j(document).ready(function () {
j('#slider1').bxSlider();
});
I had the same problem... i was editing the worpress default "twenty ten" theme when i had this problem "bxSlider is not a function". I checked that it loaded properly and everything but couldn't figure it out later i uninstalled a plugin called "TubePress" and the slider started working somehow. I tried it again by installing that pluggin and running bxslider again and i got the same error. So i am pretty sure that it was due to conflict with some of the scripts that were loaded by that plugin which created that problem.
So my suggestion is that you can just go on unmenting scripts to find out which script is conflicting wth bxslider.
Sorry this is not a very convincing solution but that is what i have right now though i'll update my answer if i find out what exactly is causing this problem.
It is most likely because the src
to your slider script is not correct:
<script src="jquery.bxSlider.min.js" type="text/javascript"></script>
======================^ It isn't valid path
本文标签: javascriptMy jquery slider is not working properlyStack Overflow
版权声明:本文标题:javascript - My jquery slider is not working properly - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741747842a2395642.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论