2012-07-27 61 views
0

我正在使用jQuery動態翻頁書。我可以添加張貼它注意到任何頁面的偶數或奇數。此代碼創建註釋選擇要添加註釋和拖動的頁面。如何在翻頁書頁中設置可拖動元素

function CreatePostIt() { 
        $("#PostIt").dialog({ modal: true, autoResize: true, height: 500, width: 530, 
         open: function() { 

          $("#BookMenu").fadeOut(500); 
          BookMenuShow = false; 
          $("#pNotes").addClass("yellow"); 
          $("#pNotes").removeClass("transparent"); 
          $("#pNotes").removeClass("blue"); 
          $("#pNotes").removeClass("green"); 
          $("#note-body").text(""); 
          $("#pNotes").css("font-size", $("#NoteFontSize").val()); 
          color = "yellow"; 
          $("#pNotes").text(""); 
          if (PageIndex == 0) { 
           $("#rightTn").click(); 

           $("#leftTn").attr("src", "images/blank.gif") 

           $("#rightTn").attr("src", tnNames[PageIndex]); 

          } else { 
           $("#leftTn").width(120); 
           $("#rightTn").width(120); 
           $("#leftTn").attr("src", tnNames[PageIndex - 1]) 
           $("#rightTn").attr("src", tnNames[PageIndex]); 
           $("#leftTn").click(); 
          } 

         }, 
         buttons: { 
          "INSERT": function() { 

           var count = $(".npg" + PageSelected).length; 

           var Annotation = $("<div style='z-index:250000' class='note npg" + PageSelected + "' index='0'></div>"); 
           var aId = "Page-" + PageSelected + "-Note-" + (count + 1); 
           AnnoCount = AnnoCount + 1; 
           $(Annotation).attr("id", "Page-" + PageSelected + "-Note-" + (count + 1)); 
           $(Annotation).css("font-size", $("#NoteFontSize").val()); 
           $(Annotation).css("display", "none"); 
           $(Annotation).append("<img class='noteClose' rel='Page-" + PageSelected + "-Note-" + (count + 1) + "' style='float:right; padding:10px 10px 5px 5px' src='images/close.gif'/>"); 
           $(Annotation).append("<div style='padding:25px 25px 25px 25px;' id='noteText" + (count + 1) + "' class='noteBody'>" + $("#note-body").val() + " </div>") 
           $(Annotation).addClass("liveNote"); 
           $(Annotation).addClass("npage" + PageSelected); 
           $(Annotation).addClass(color); 
           $("#pgDv" + (PageSelected)).prepend(Annotation); 
           $.cookie("Book-" + bookid + "-Page-" + PageSelected, aId + "||" + $("#note-body").val() + "||" + "0,0,0,0||" + color + "||" + $("#NoteFontSize").val() + "<*>", { expires: 365, path: "/" }); 

           **if (ZoomOn != true) { 
            if ("#rightPageShadow") { 
            Annotation.draggable({ cusror: "pointer", containment: 'parent'         
              }); 
           } else { 
            Annotation.draggable({ cusror: "pointer", containment: "#leftPageShadow" 
            }); 
           } 
           } 
           else if (ZoomOn = true) { 
            Annotation.draggable({ 
             create: function() { 
              $(this).show(); 
             }, 
             cusror: "pointer", 
             containment: "parent" 
            }); 
           } 
           $(Annotation).show(); 
           // $("#PostItNoteInd").show(); 
           $(this).dialog("close"); 
           $("#note-body").text("");** 
          } 
        , "CANCEL": function() { 
         $("#pNotes").text(""); 
         $("#leftTn").attr("rel", -10); 
         $("#leftTn").css("border", "0px solid red"); 
         $("#rightTn").attr("rel", -10); 
         $("#rightTn").css("border", "0px solid red"); 
         $(this).dialog("close"); 
        } 
         } 
        }); 
        var cw = $("#PostItDialogContent").width(); 
        $("#PostIt").dialog("option", "width", cw + 20); 

       } 

我的問題已經是當在便籤上左邊的網頁上的位置和頂部它的工作原理。但在右側和底部卻沒有。我試過[x,y,x1,y1],但是因爲每本書都不同,所以我嘗試使用我的id標籤,如果你在div上使用#leftPageShadow並且其他是#rightPageShadow

回答

1

問題修復我丟失了cookie ID更改Cookie代碼。

相關問題