簡體   English   中英

在觸摸設備上添加注釋時,如何阻止頁面滾動?

[英]How can I stop my page from scrolling when I annotate on a touch device?

問題在此頁面上: http : //www.tagalogreader.com/document.php?id=28

我正在使用這個: https : //github.com/aron/annotator.touch.js和這個https://github.com/openannotation/annotator

使用ipad時發現了一個煩人的錯誤。 當我突出顯示一些文本然后單擊“注釋”時,將彈出框以寫注釋。 這是所希望的。 但是接下來發生的是,即使我在文章開頭強調了某些內容,我仍然會以某種方式自動滾動到文章的中間。 所以我只需要向上滾動。

我該如何解決這個問題?

這是一個在顯示注釋器編輯器時禁用滾動條的插件:

/**
* Annotator Plugin to diasble scrollbar when Editor is shown
*/
Annotator.Plugin.DisableScroll = function (element, options) {
  var myPlugin = {};
  myPlugin.pluginInit = function () {
    // This annotator instance
    this.annotator
        .subscribe("annotationEditorShown", function (editor, annotation) {
          $(window).disablescroll();
        })
        .subscribe("annotationEditorHidden", function (editor) {
          $(window).disablescroll("undo");
        })
  };
  return myPlugin;
};

這取決於Josh Harrison編寫的jQuery 插件

用法:

jQuery(function ($) {
    $('#content').annotator().annotator('addPlugin', 'DisableScroll');
});

演示: http : //jsbin.com/saratucapa/1/edit?js,輸出

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM