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?
function dropItems(idOfDraggedItem,targetId,x,y)
{
var numbers = targetId.slice(4,5);
if(document.getElementById('parent_div_'+numbers)){
var typ = confirm("Czy chcesz zamienic zdjecie?");
if(typ == true){
$('#vbox div#parent_div_'+numbers).remove();
$("#generation input[name=img_"+numbers+"]").remove();
$("#generation input[name=parent_div_"+numbers+"]").remove();
$("#generation input[name=parent_div_"+numbers+"_size]").remove();
}else{
null.dummy;
}
}
var photo = $('#'+idOfDraggedItem).attr("src").valueOf();
var size = 0;
var heightImgs = 0;
var proc = 0;
heavyImage = new Image();
heavyImage.src = photo;
if(heavyImage.width > 500){
size = 500;
proc = heavyImage.width/500;
heightImgs = heavyImage.height/proc;
}else{
size = heavyImage.width;
heightImgs = heavyImage.height;
}
$('#generation').append('<input type="hidden" name="img_'+numbers+'" value="'+photo+'">');
$('<div class="drag images boxrotate '+targetId+'" id="parent_div_'+ numbers +'" onclick="getPosition(this)" style="position:absolute; height: '+heightImgs+'px;"/>')
.html('<img class="imgVbox maskable" id="img_'+ numbers +'" src="'+photo+'" style="width: '+size+'px; " />')
.appendTo('#vbox')
.css({
top: (y-22)- (heightImgs/2),
left: (x-450)- (size/2)
})
.hover(function(){
$('#vbox div#'+this.id).append('<span class="delete" onclick="deleteElement(this, 1)"></span>');
$('#vbox div#'+this.id).append('<span class="move"></span>');
$('#vbox div#'+this.id).append('<span class="edit" onclick="rotateElement(this, 1)"></span>');
$('#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>');
$('#vbox div#'+this.id+' img').css("opacity", "0.3");
},
function() {
$('#vbox div#'+this.id+' span').remove();
$('#vbox div#'+this.id+' div').remove();
$('#vbox div#'+this.id+' img').css("opacity", "1");
$('#vbox div#'+this.id).css("zIndex", "1");
}).hover(function(){
$( this ).toggleClass("selected");
})
.drag("init",function(){
if ( $( this ).is('.selected') )
return $('.selected');
})
.drag("start",function( ev, dd ){
dd.attr = $(ev.target).attr("className");
dd.width = $( this ).width();
dd.height = $( this ).height();
}).drag(function( ev, dd ){
var props = {};
if ( dd.attr.indexOf("E") > -1 ){
props
.width
= Math
.max( 32
, dd
.width
+ dd
.deltaX
); }
if ( dd.attr.indexOf("W") > -1 ){
props
.width
= Math
.max( 32
, dd
.width
- dd
.deltaX
); props.left = dd.originalX + dd.width - props.width;
}
if ( dd.attr.indexOf("drag") > -1 ){
props.top = dd.offsetY;
props.left = dd.offsetX;
}
$('#'+this.id+' img').css( props );
var heightDiv = $('#'+this.id+' img').height();
$('#'+this.id).css('height', heightDiv);
if(props.width == null){
var divC = $('#vbox');
var drags = $('textarea');
var topC = dd.offsetY-22;
var leftC = dd.offsetX-450;
if(topC < 0){topC = 0;}
//if(topC > divC.height()){topC = divC.height()-;}
if(leftC < 0){leftC = 0;}
if(leftC > (divC.width()-drags.width())){leftC = (divC.width()-drags.width());}
$( this ).css({
top: topC,
left: leftC
});
}
});
}