dsp77 Posted March 1, 2011 Share Posted March 1, 2011 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 https://forums.phpfreaks.com/topic/229229-2-javascripts-conflict/ Share on other sites More sharing options...
Adam Posted March 1, 2011 Share Posted March 1, 2011 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 https://forums.phpfreaks.com/topic/229229-2-javascripts-conflict/#findComment-1181146 Share on other sites More sharing options...
dsp77 Posted March 1, 2011 Author Share Posted March 1, 2011 It works with your last suggestion even both are jquery. Thanks a lot Link to comment https://forums.phpfreaks.com/topic/229229-2-javascripts-conflict/#findComment-1181215 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.