Witam,

Mam problem otórz mam skrypt, który działa na wersji mniejszej niż 1.6.0 JQuery

dokładnie to metoda dd.attr.indexOf("E") która już na starszych wersjach nie działa lecz potrzebuje uzyć wersji 1.8.2 i w tym momencie tworzy się konflikt, próbowałem uzyć jQuery.noConflict(), jednak nie przyniosło to spodziewanego efektu ktoś wie jak
w nowszych wersjach zastąpić np attr.indexOf("E") cos takiego?

  1. function dropItems(idOfDraggedItem,targetId,x,y)
  2. {
  3. var numbers = targetId.slice(4,5);
  4. if(document.getElementById('parent_div_'+numbers)){
  5. var typ = confirm("Czy chcesz zamienic zdjecie?");
  6. if(typ == true){
  7. $('#vbox div#parent_div_'+numbers).remove();
  8. $("#generation input[name=img_"+numbers+"]").remove();
  9. $("#generation input[name=parent_div_"+numbers+"]").remove();
  10. $("#generation input[name=parent_div_"+numbers+"_size]").remove();
  11. }else{
  12. null.dummy;
  13. }
  14. }
  15.  
  16.  
  17. var photo = $('#'+idOfDraggedItem).attr("src").valueOf();
  18. var size = 0;
  19. var heightImgs = 0;
  20. var proc = 0;
  21. heavyImage = new Image();
  22. heavyImage.src = photo;
  23.  
  24. if(heavyImage.width > 500){
  25. size = 500;
  26. proc = heavyImage.width/500;
  27. heightImgs = heavyImage.height/proc;
  28. }else{
  29. size = heavyImage.width;
  30. heightImgs = heavyImage.height;
  31. }
  32.  
  33. $('#generation').append('<input type="hidden" name="img_'+numbers+'" value="'+photo+'">');
  34. $('<div class="drag images boxrotate '+targetId+'" id="parent_div_'+ numbers +'" onclick="getPosition(this)" style="position:absolute; height: '+heightImgs+'px;"/>')
  35. .html('<img class="imgVbox maskable" id="img_'+ numbers +'" src="'+photo+'" style="width: '+size+'px; " />')
  36. .appendTo('#vbox')
  37. .css({
  38. top: (y-22)- (heightImgs/2),
  39. left: (x-450)- (size/2)
  40. })
  41. .hover(function(){
  42. $('#vbox div#'+this.id).append('<span class="delete" onclick="deleteElement(this, 1)"></span>');
  43. $('#vbox div#'+this.id).append('<span class="move"></span>');
  44. $('#vbox div#'+this.id).append('<span class="edit" onclick="rotateElement(this, 1)"></span>');
  45. $('#vbox div#'+this.id).append('<div class="handle NE" onclick="getPosition(this)"></div><div class="handle NW" onclick="getPosition(this)"></div><div class="handle SW" onclick="getPosition(this)"></div><div class="handle SE" onclick="getPosition(this)"></div>');
  46. $('#vbox div#'+this.id+' img').css("opacity", "0.3");
  47. },
  48. function() {
  49. $('#vbox div#'+this.id+' span').remove();
  50. $('#vbox div#'+this.id+' div').remove();
  51. $('#vbox div#'+this.id+' img').css("opacity", "1");
  52. $('#vbox div#'+this.id).css("zIndex", "1");
  53. }).hover(function(){
  54. $( this ).toggleClass("selected");
  55. })
  56. .drag("init",function(){
  57. if ( $( this ).is('.selected') )
  58. return $('.selected');
  59. })
  60. .drag("start",function( ev, dd ){
  61. dd.attr = $(ev.target).attr("className");
  62. dd.width = $( this ).width();
  63. dd.height = $( this ).height();
  64. }).drag(function( ev, dd ){
  65. var props = {};
  66. if ( dd.attr.indexOf("E") > -1 ){
  67. props.width = Math.max( 32, dd.width + dd.deltaX );
  68. }
  69. if ( dd.attr.indexOf("W") > -1 ){
  70. props.width = Math.max( 32, dd.width - dd.deltaX );
  71. props.left = dd.originalX + dd.width - props.width;
  72. }
  73. if ( dd.attr.indexOf("drag") > -1 ){
  74. props.top = dd.offsetY;
  75. props.left = dd.offsetX;
  76. }
  77. $('#'+this.id+' img').css( props );
  78. var heightDiv = $('#'+this.id+' img').height();
  79. $('#'+this.id).css('height', heightDiv);
  80. if(props.width == null){
  81. var divC = $('#vbox');
  82. var drags = $('textarea');
  83.  
  84. var topC = dd.offsetY-22;
  85. var leftC = dd.offsetX-450;
  86. if(topC < 0){topC = 0;}
  87. //if(topC > divC.height()){topC = divC.height()-;}
  88. if(leftC < 0){leftC = 0;}
  89. if(leftC > (divC.width()-drags.width())){leftC = (divC.width()-drags.width());}
  90.  
  91. $( this ).css({
  92. top: topC,
  93. left: leftC
  94. });
  95. }
  96. });
  97.  
  98. }