No.Conflict

No.Conflict

I have the following plugin that I downloaded from here:  http://www.dreamcss.com/2009/04/create-beautiful-jquery-sliders.html

  1. window.onerror=function(desc,page,line,chr){
  2. /* alert('JavaScript error occurred! '
  3.   +' Error description: '+desc
  4.   +' Page address:       '+page
  5.   +' Line number:       '+line
  6.  );*/
  7. }

  8. $(function(){
  9.  $('a').focus(function(){this.blur();});
  10.  SI.Files.stylizeAll();
  11.  slider.init();

  12.  $('input.text-default').each(function(){
  13.   $(this).attr('default',$(this).val());
  14.  }).focus(function(){
  15.   if($(this).val()==$(this).attr('default'))
  16.    $(this).val('');
  17.  }).blur(function(){
  18.   if($(this).val()=='')
  19.    $(this).val($(this).attr('default'));
  20.  });

  21.  $('input.text,textarea.text').focus(function(){
  22.   $(this).addClass('textfocus');
  23.  }).blur(function(){
  24.   $(this).removeClass('textfocus');
  25.  });

  26.  var popopenobj=0,popopenaobj=null;
  27.  $('a.popup').click(function(){
  28.   var pid=$(this).attr('rel').split('|')[0],_os=parseInt($(this).attr('rel').split('|')[1]);
  29.   var pobj=$('#'+pid);
  30.   if(!pobj.length)
  31.    return false;
  32.   if(typeof popopenobj=='object' && popopenobj.attr('id')!=pid){
  33.    popopenobj.hide(50);
  34.    $(popopenaobj).parent().removeClass(popopenobj.attr('id').split('-')[1]+'-open');
  35.    popopenobj=null;
  36.   }
  37.   return false;
  38.  });
  39.  $('p.images img').click(function(){
  40.   var newbg=$(this).attr('src').split('bg/bg')[1].split('-thumb')[0];
  41.   $(document.body).css('backgroundImage','url('+_siteRoot+'images/bg/bg'+newbg+'.jpg)');
  42.  
  43.   $(this).parent().find('img').removeClass('on');
  44.   $(this).addClass('on');
  45.   return false;
  46.  });
  47.  $(window).load(function(){
  48.   $.each(css_ims,function(){(new Image()).src=_siteRoot+'css/images/'+this;});
  49.   $.each(css_cims,function(){
  50.    var css_im=this;
  51.    $.each(['blue','purple','pink','red','grey','green','yellow','orange'],function(){
  52.     (new Image()).src=_siteRoot+'css/'+this+'/'+css_im;
  53.    });
  54.   });
  55.  }); 
  56.  $('div.sc-large div.img:has(div.tml)').each(function(){
  57.   $('div.tml',this).hide();
  58.   $(this).append('<a href="#" class="tml_open">&nbsp;</a>').find('a').css({
  59.    left:parseInt($(this).offset().left)+864,top:parseInt($(this).offset().top)+1
  60.   }).click(function(){
  61.    $(this).siblings('div.tml').slideToggle();
  62.    return false;
  63.   }).focus(function(){this.blur();}); 
  64.  });
  65. });
  66. var slider={
  67.  num:-1,
  68.  cur:0,
  69.  cr:[],
  70.  al:null,
  71.  at:10*1000,
  72.  ar:true,
  73.  init:function(){
  74.   if(!slider.data || !slider.data.length)
  75.    return false;

  76.   var d=slider.data;
  77.   slider.num=d.length;
  78.   var pos=Math.floor(Math.random()*1);//slider.num);
  79.   for(var i=0;i<slider.num;i++){
  80.    $('#'+d[i].id).css({left:((i-pos)*1000)});
  81.    $('#slide-nav').append('<a id="slide-link-'+i+'" href="#" onclick="slider.slide('+i+');return false;" onfocus="this.blur();">'+(i+1)+'</a>');
  82.   }

  83.   $('img,div#slide-controls',$('div#slide-holder')).fadeIn();
  84.   slider.text(d[pos]);
  85.   slider.on(pos);
  86.   slider.cur=pos;
  87.   window.setTimeout('slider.auto();',slider.at);
  88.  },
  89.  auto:function(){
  90.   if(!slider.ar)
  91.    return false;

  92.   var next=slider.cur+1;
  93.   if(next>=slider.num) next=0;
  94.   slider.slide(next);
  95.  },
  96.  slide:function(pos){
  97.   if(pos<0 || pos>=slider.num || pos==slider.cur)
  98.    return;

  99.   window.clearTimeout(slider.al);
  100.   slider.al=window.setTimeout('slider.auto();',slider.at);

  101.   var d=slider.data;
  102.   for(var i=0;i<slider.num;i++)
  103.    $('#'+d[i].id).stop().animate({left:((i-pos)*1000)},1000,'swing');
  104.   
  105.   slider.on(pos);
  106.   slider.text(d[pos]);
  107.   slider.cur=pos;
  108.  },
  109.  on:function(pos){
  110.   $('#slide-nav a').removeClass('on');
  111.   $('#slide-nav a#slide-link-'+pos).addClass('on');
  112.  },
  113.  text:function(di){
  114.   slider.cr['a']=di.client;
  115.   slider.cr['b']=di.desc;
  116.   slider.ticker('#slide-client span',di.client,0,'a');
  117.   slider.ticker('#slide-desc',di.desc,0,'b');
  118.  },
  119.  ticker:function(el,text,pos,unique){
  120.   if(slider.cr[unique]!=text)
  121.    return false;

  122.   ctext=text.substring(0,pos)+(pos%2?'-':'_');
  123.   $(el).html(ctext);

  124.   if(pos==text.length)
  125.    $(el).html(text);
  126.   else
  127.    window.setTimeout('slider.ticker("'+el+'","'+text+'",'+(pos+1)+',"'+unique+'");',30);
  128.  }
  129. };
  130. // STYLING FILE INPUTS 1.0 | Shaun Inman <http://www.shauninman.com/> | 2007-09-07
  131. if(!window.SI){var SI={};};
  132. SI.Files={
  133.  htmlClass:'SI-FILES-STYLIZED',
  134.  fileClass:'file',
  135.  wrapClass:'cabinet',
  136.  
  137.  fini:false,
  138.  able:false,
  139.  init:function(){
  140.   this.fini=true;
  141.  },
  142.  stylize:function(elem){
  143.   if(!this.fini){this.init();};
  144.   if(!this.able){return;};
  145.   
  146.   elem.parentNode.file=elem;
  147.   elem.parentNode.onmousemove=function(e){
  148.    if(typeof e=='undefined') e=window.event;
  149.    if(typeof e.pageY=='undefined' &&  typeof e.clientX=='number' && document.documentElement){
  150.     e.pageX=e.clientX+document.documentElement.scrollLeft;
  151.     e.pageY=e.clientY+document.documentElement.scrollTop;
  152.    };
  153.    var ox=oy=0;
  154.    var elem=this;
  155.    if(elem.offsetParent){
  156.     ox=elem.offsetLeft;
  157.     oy=elem.offsetTop;
  158.     while(elem=elem.offsetParent){
  159.      ox+=elem.offsetLeft;
  160.      oy+=elem.offsetTop;
  161.     };
  162.    };
  163.   };
  164.  },
  165.  stylizeAll:function(){
  166.   if(!this.fini){this.init();};
  167.   if(!this.able){return;};
  168.  }
  169. };
I am new to Jquery so I am not sure if I have done this right but the following was my attempted fix. It doesn't seem to work thou. Any idea what I did wrong?


  1. window.onerror=function(desc,page,line,chr){
  2. /* alert('JavaScript error occurred! '
  3.   +' Error description: '+desc
  4.   +' Page address:       '+page
  5.   +' Line number:       '+line
  6.  );*/
  7. }
  8. jQuery.noConflict();
  9. $(function(){
  10.  $('a').focus(function(){this.blur();});
  11.  SI.Files.stylizeAll();
  12.  slider.init();

  13.  $('input.text-default').each(function(){
  14.   $(this).attr('default',$(this).val());
  15.  }).focus(function(){
  16.   if($(this).val()==$(this).attr('default'))
  17.    $(this).val('');
  18.  }).blur(function(){
  19.   if($(this).val()=='')
  20.    $(this).val($(this).attr('default'));
  21.  });

  22.  $('input.text,textarea.text').focus(function(){
  23.   $(this).addClass('textfocus');
  24.  }).blur(function(){
  25.   $(this).removeClass('textfocus');
  26.  });

  27.  var popopenobj=0,popopenaobj=null;
  28.  $('a.popup').click(function(){
  29.   var pid=$(this).attr('rel').split('|')[0],_os=parseInt($(this).attr('rel').split('|')[1]);
  30.   var pobj=$('#'+pid);
  31.   if(!pobj.length)
  32.    return false;
  33.   if(typeof popopenobj=='object' && popopenobj.attr('id')!=pid){
  34.    popopenobj.hide(50);
  35.    $(popopenaobj).parent().removeClass(popopenobj.attr('id').split('-')[1]+'-open');
  36.    popopenobj=null;
  37.   }
  38.   return false;
  39.  });
  40.  $('p.images img').click(function(){
  41.   var newbg=$(this).attr('src').split('bg/bg')[1].split('-thumb')[0];
  42.   $(document.body).css('backgroundImage','url('+_siteRoot+'images/bg/bg'+newbg+'.jpg)');
  43.  
  44.   $(this).parent().find('img').removeClass('on');
  45.   $(this).addClass('on');
  46.   return false;
  47.  });
  48.  $(window).load(function(){
  49.   $.each(css_ims,function(){(new Image()).src=_siteRoot+'css/images/'+this;});
  50.   $.each(css_cims,function(){
  51.    var css_im=this;
  52.    $.each(['blue','purple','pink','red','grey','green','yellow','orange'],function(){
  53.     (new Image()).src=_siteRoot+'css/'+this+'/'+css_im;
  54.    });
  55.   });
  56.  }); 
  57.  $('div.sc-large div.img:has(div.tml)').each(function(){
  58.   $('div.tml',this).hide();
  59.   $(this).append('<a href="#" class="tml_open">&nbsp;</a>').find('a').css({
  60.    left:parseInt($(this).offset().left)+864,top:parseInt($(this).offset().top)+1
  61.   }).click(function(){
  62.    $(this).siblings('div.tml').slideToggle();
  63.    return false;
  64.   }).focus(function(){this.blur();}); 
  65.  });
  66. })(jQuery);
  67. var slider={
  68.  num:-1,
  69.  cur:0,
  70.  cr:[],
  71.  al:null,
  72.  at:10*1000,
  73.  ar:true,
  74.  init:function(){
  75.   if(!slider.data || !slider.data.length)
  76.    return false;

  77.   var d=slider.data;
  78.   slider.num=d.length;
  79.   var pos=Math.floor(Math.random()*1);//slider.num);
  80.   for(var i=0;i<slider.num;i++){
  81.    $('#'+d[i].id).css({left:((i-pos)*1000)});
  82.    $('#slide-nav').append('<a id="slide-link-'+i+'" href="#" onclick="slider.slide('+i+');return false;" onfocus="this.blur();">'+(i+1)+'</a>');
  83.   }

  84.   $('img,div#slide-controls',$('div#slide-holder')).fadeIn();
  85.   slider.text(d[pos]);
  86.   slider.on(pos);
  87.   slider.cur=pos;
  88.   window.setTimeout('slider.auto();',slider.at);
  89.  },
  90.  auto:function(){
  91.   if(!slider.ar)
  92.    return false;

  93.   var next=slider.cur+1;
  94.   if(next>=slider.num) next=0;
  95.   slider.slide(next);
  96.  },
  97.  slide:function(pos){
  98.   if(pos<0 || pos>=slider.num || pos==slider.cur)
  99.    return;

  100.   window.clearTimeout(slider.al);
  101.   slider.al=window.setTimeout('slider.auto();',slider.at);

  102.   var d=slider.data;
  103.   for(var i=0;i<slider.num;i++)
  104.    $('#'+d[i].id).stop().animate({left:((i-pos)*1000)},1000,'swing');
  105.   
  106.   slider.on(pos);
  107.   slider.text(d[pos]);
  108.   slider.cur=pos;
  109.  },
  110.  on:function(pos){
  111.   $('#slide-nav a').removeClass('on');
  112.   $('#slide-nav a#slide-link-'+pos).addClass('on');
  113.  },
  114.  text:function(di){
  115.   slider.cr['a']=di.client;
  116.   slider.cr['b']=di.desc;
  117.   slider.ticker('#slide-client span',di.client,0,'a');
  118.   slider.ticker('#slide-desc',di.desc,0,'b');
  119.  },
  120.  ticker:function(el,text,pos,unique){
  121.   if(slider.cr[unique]!=text)
  122.    return false;

  123.   ctext=text.substring(0,pos)+(pos%2?'-':'_');
  124.   $(el).html(ctext);

  125.   if(pos==text.length)
  126.    $(el).html(text);
  127.   else
  128.    window.setTimeout('slider.ticker("'+el+'","'+text+'",'+(pos+1)+',"'+unique+'");',30);
  129.  }
  130. };
  131. // STYLING FILE INPUTS 1.0 | Shaun Inman <http://www.shauninman.com/> | 2007-09-07
  132. if(!window.SI){var SI={};};
  133. SI.Files={
  134.  htmlClass:'SI-FILES-STYLIZED',
  135.  fileClass:'file',
  136.  wrapClass:'cabinet',
  137.  
  138.  fini:false,
  139.  able:false,
  140.  init:function(){
  141.   this.fini=true;
  142.  },
  143.  stylize:function(elem){
  144.   if(!this.fini){this.init();};
  145.   if(!this.able){return;};
  146.   
  147.   elem.parentNode.file=elem;
  148.   elem.parentNode.onmousemove=function(e){
  149.    if(typeof e=='undefined') e=window.event;
  150.    if(typeof e.pageY=='undefined' &&  typeof e.clientX=='number' && document.documentElement){
  151.     e.pageX=e.clientX+document.documentElement.scrollLeft;
  152.     e.pageY=e.clientY+document.documentElement.scrollTop;
  153.    };
  154.    var ox=oy=0;
  155.    var elem=this;
  156.    if(elem.offsetParent){
  157.     ox=elem.offsetLeft;
  158.     oy=elem.offsetTop;
  159.     while(elem=elem.offsetParent){
  160.      ox+=elem.offsetLeft;
  161.      oy+=elem.offsetTop;
  162.     };
  163.    };
  164.   };
  165.  },
  166.  stylizeAll:function(){
  167.   if(!this.fini){this.init();};
  168.   if(!this.able){return;};
  169.  }
  170. };