PDA

View Full Version : Resolved Featured Content Glider preventing simple Jquery ready script



InsanitysMuse
10-24-2012, 06:38 PM
1) Script Title: Featured Content Glider

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/featuredcontentglider.htm

3) Describe problem: I have Featured Content Glider working fine on the website I'm revamping, but I've run into a problem now that I'm trying to add a jQuery/ajax script of my own to the page. It appears the featuredcontentglider.js file is preventing my script from triggering, regardless of positioning. I've confirmed that it's just the featuredcontentglider.js file through various tests, and even just putting a semicolon near the end of the .js will let my script trigger, but then the content glider doesn't work.

My incredibly simple script is:



<script>
$(function()
{
$(".widecol").load("home.html");
});
</script>

I'm planning to turn it into a content loader so the content of the page changes without reloading the whole thing. I'm brand new to javascript/jquery so I can't identify if there's a missing piece of code in the featuredcontentglider.js that is preventing my script from firing.

ajfmrf
10-24-2012, 06:56 PM
Please post a link to the problem page-it will make helping you easier.

jscheuer1
10-24-2012, 07:20 PM
If you're lucky, all you need to do is comment out the noConflict directive in the featuredcontentglider.js script using a text only editor like NotePad, as shown:


//Featured Content Glider: By http://www.dynamicdrive.com
//Created: Dec 22nd, 07'
//Updated (Jan 29th, 08): Added four possible slide directions: "updown", "downup", "leftright", or "rightleft"
//Updated (Feb 1st, 08): Changed glide behavior to reverse direction when previous button is clicked
//Updated (Feb 12th, 08): Added ability to retrieve gliding contents from an external file using Ajax ("remotecontent" variable added to configuration)
//Updated (July 21st, 09): Updated to work in jQuery 1.3.x
//Updated (Dec 13th, 09): Added keyboard navigation, so left/ right arrow keys now move glider. Fixed bug with auto rotation when "next" link isn't defined.

//jQuery.noConflict()

var featuredcontentglider={
leftrightkeys: [37, 39], //keycodes to move glider back and forth 1 slide, respectively. Enter [] to disable feature.
csszindex: 100,
ajaxloadingmsg: '<b>Fetching Con

That assumes that your jQuery AJAX code works on its own.

InsanitysMuse
10-24-2012, 07:27 PM
Hopefully this doesn't double post... but looks like I'm lucky (today)! Commenting that out made everything work great so far. I will have to learn what that does and make sure I can move forward :P Thank you!

jscheuer1
10-24-2012, 07:33 PM
The board automatically moderated your post for some reason, excessive quoting perhaps. Anyways, great! A simple explanation of what noConflict mode does is prevent jQuery from interfering with other script libraries that use the $ variable. Works great for that, but if you have another script that uses jQuery on the page, that other script must be written to use jQuery in noConflict mode, otherwise $ won't be available to it.

More info available here:

http://api.jquery.com/jQuery.noConflict/