所以我有一个包含一个文本块的div,之前用户已经在这个块中选择了一些文本,我从这个选择中创建了一个范围对象.我存储了所选文本的起点和终点的偏移量,但是我在重新创建范围时遇到了问题(所以我可以操作它)."quotables"是包含所有文本的div.我不知道我做错了什么.
var theRange = rangy.createRange();
var node = $('.quotables').html();
theRange.setStart(node, 14);
theRange.setEnd(node, 318);
但我一直收到错误:未捕获错误:NOT_FOUND_ERR:DOM异常8
m.setStart
(匿名函数)
d.extend._Deferred.f.resolveWith
ddextend.ready
dcaddEventListener.y
所以我正在创建一个网页,左侧的菜单是固定的(当您向上和向下滚动页面时,它们会跟随您).我目前正在使用网格布局:基础(由zurb)http://foundation.zurb.com/docs/grid.php.它使用十二列网格.我在定位固定布局和仍然同时使用网格时遇到问题.如何在页面上使用网格布局和固定元素?
<div class="container">
<div class="row">
<div class="four columns relativePosition">
<div class="fixedPosition">
<div class="four columns">
Menu Here
</div>
</div>
</div>
<div class="eight columns">
Other Content
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我能够使用这种结构使固定位置工作,但在某些情况下,菜单的内容变得太大并且与八列的内容重叠.我不知道是否有更好的方法来做到这一点?
我正在使用Range来操作所选文本.我想计算某人开始选择文本到完成位置的高度.
我已经尝试了所选范围的开始和结束的跨度,我可以准确地计算高度形式,但它改变了DOM并阻止我进行其他范围操作,如突出显示以前选择的文本.
我也尝试过收集mosedown和mosueup位置的位置,但我需要从所选文本的顶部到选择被释放的文本底部的准确高度,并非总是如此.
所以我想知道是否有办法在不改变DOM的情况下计算文本选择的高度?
我在我的Gemfile中添加了独角兽,之后当我进行捆绑安装时,我收到了这个错误
em::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/adim86/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb
checking for CLOCK_MONOTONIC in time.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/adim86/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
/Users/adim86/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/adim86/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:491:in …Run Code Online (Sandbox Code Playgroud) 我正在开发一个cordova应用程序并尝试将它生成的swift代码转换为swift 3语法,因为当我尝试构建它时它会产生错误。我有这个功能
init(configuration: WebAppConfiguration, versionsDirectoryURL: URL, initialAssetBundle: AssetBundle) {
self.configuration = configuration
self.versionsDirectoryURL = versionsDirectoryURL
self.initialAssetBundle = initialAssetBundle
downloadDirectoryURL = versionsDirectoryURL.appendingPathComponent("Downloading")
queue = DispatchQueue(label: "com.meteor.webapp.AssetBundleManager", attributes: [])
downloadedAssetBundlesByVersion = [String: AssetBundle]()
loadDownloadedAssetBundles()
let operationQueue = OperationQueue()
operationQueue.maxConcurrentOperationCount = 1
operationQueue.underlyingQueue = queue
// We use a separate to download the manifest, so we can use caching
// (which we disable for the session we use to download the other files
// in AssetBundleDownloader)
session = URLSession(configuration: URLSessionConfiguration.default, delegate: nil, delegateQueue: …Run Code Online (Sandbox Code Playgroud) 我正在将代码转换为Swift 3语法
if !data.writeToURL(manifestFileURL, atomically: false) {
self.didFailWithError(WebAppError.fileSystemFailure(reason: "Could not write asset manifest to: \(manifestFileURL)", underlyingError: error))
return
}
Run Code Online (Sandbox Code Playgroud)
但我得到了错误
类型“数据”的值没有成员“ writeToURL”
我已经将代码转换为
if try!data.write(to: manifestFileURL, atomically: false) {
self.didFailWithError(WebAppError.fileSystemFailure(reason: "Could not write asset manifest to: \(manifestFileURL)", underlyingError: error))
return
}
Run Code Online (Sandbox Code Playgroud)
遵循迅速的3语法和当前方法(https://developer.apple.com/reference/foundation/nsdata/1415134-write),但是我收到错误消息,说这不是该函数的正确重载。请以正确的方式迅速写出这篇文章的正确方法是3。任何可以引导我朝正确方向前进的信息将不胜感激。
谢谢
我有一个 Sinatra 脚本,我有一个通用方法或一组在多个地方使用的操作,我想将其抽象为一个方法。我无法找到帮助我完成此操作的文档,请问有人有任何想法吗?
一个典型的脚本如下所示:
require 'sinatra'
get '/' do
'Hello world!'
end
get '/statement' do
'Hello world!'
end
Run Code Online (Sandbox Code Playgroud)
如果我想创建一个函数greetings(),该函数同时显示“Hello world”/和 ,那么语法是什么/statement?
cordova ×2
css ×2
dom ×2
html ×2
ios ×2
javascript ×2
range ×2
ruby ×2
swift ×2
css-position ×1
frameworks ×1
function ×1
gem ×1
grid-layout ×1
height ×1
methods ×1
rangy ×1
rvm ×1
sinatra ×1
unicorn ×1