我有一些图像。图像在另一个之上,根据情况我必须显示一个或另一个,但我的过程不起作用。这是代码
AddHTMLToCurrentSlide('<div id="slide14_gc"></div>');
AddHTMLToCurrentSlide('<div classe="drag-x" id="slide14_gp"></div>');
AddHTMLToCurrentSlide('<div id="slide14_empty"></div>');
AddHTMLToCurrentSlide('<div id="slide14_25mg"></div>');
AddHTMLToCurrentSlide('<div id="slide14_50mg"></div>');
$(function () {
$("#slide14_gc").hide(); //here work
$("#slide14_gp").show();
$("#slide14_gc").draggable({
handle:"#slide14_gc",
containment: [50,105,625,48],
axis: "x"
});
$("#slide14_gp").draggable({
handle:"#slide14_gc",
containment: [50,105,625,48],
axis: "x"
});
var part =parseInt($('#slide14_gc').css('left'));
var maxlungh =parseInt($('#slide14_gc').css('width'));
var arr = parseInt(part) + parseInt(maxlungh);
var pos =$("#slide14_gc").position();
if(pos == part){
$("#slide14_gc").hide();
$("#slide14_gp").show();
$("#slide14_empty").show(); //not show
$("#slide14_25mg").hide(); //not hide
$("#slide14_50mg").hide(); //not hide
}
if(pos>part && pos<265){
$("#slide14_gc").show();
$("#slide14_gp").hide();
$("#slide14_empty").hide(); //not hide
$("#slide14_25mg").show(); //not show
$("#slide14_50mg").hide(); //not hide
}
if(pos>265 && pose<arr){
$("#slide14_empty").hide(); //not hide
$("#slide14_25mg").hide(); //not hide
$("#slide14_50mg").show(); //not show
}
});