Jump to content

2 Javascripts conflict


dsp77

Recommended Posts

Hello,

I have 2 java scripts that don't work together i tried to combine them but no success the first script is for the menu:

<script type = "text/javascript" >

var $jq = jQuery.noConflict();
$jq(document).ready(function() {

	// default behavior
	$jq(".blink").cyclicFade();
	$jq("#blink2").cyclicFade({
		repeat: 0,
		params: [
			{fadeout:100, stayout:300, opout:0, fadein:100, stayin:3000, opin:0.5},
			{fadeout:100, stayout:300, opout:0, fadein:100, stayin:300, opin:0.75},
			{fadeout:100, stayout:300, opout:0, fadein:100, stayin:300, opin:1.0}
		]
	});
	$jq("#blink3").cyclicFade({
		repeat: 4,
		params: [
			{fadeout:2000, stayout:300, opout:0, fadein:2000, stayin:300, opin:1.0}
		]
	});		
});	
</script>

and the second is for a image slider:

<script type="text/javascript">
$(window).load(function(){	

var options = {
			delay: 3000,
			type:['fade','columnflyin','rowgrowin','blockshrink','columndropin','rowslideleft','blockgrow','columnfade','blockrandomin','rowthin','blockdrop','columnrandom','rowrandom','blockflyout','columnthin','blockdropin'],
			controls:'.controls.first_example',
			next:'.next',
			prev:'.prev'
		};
$('.container.first_example').svUltimateSlider(options);


});
</script>

Any advise to make them work together?

Link to comment
Share on other sites

var $jq = jQuery.noConflict();

 

You're removing the $ alias to jQuery with this line, but then trying to use the $ alias later with the second script. Unless you're using other frameworks, you don't need to do that. Remove the line quoted above and convert all "$jq" to just "$". If you do have other frameworks, or use $ in some other way, go through the second script and convert all "$" to "$jq".

 

One other option, if you don't like the "$jq" alias, is to remove the assignment in the line above (i.e. "var $jq =") and access jQuery through it's normal var name "jQuery" - instead of "$jq".

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.