问题标签 [anchorpoint]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ios - 围绕锚点旋转正在跳跃
我有 TagView,它是 UIView 的子类。我像这样围绕锚点旋转它:
我正在使用此处提出的方法设置锚点:
我有一个自动布局问题,我通过将我的视图放入容器 UIView 并将其设置为中心来解决这个问题。但是,当我更改视图中标签的内容时,它会跳转。
css - 使用 Foundation 滚动单个页面时激活顶部导航链接
如果您看到我的Codepen,您会看到,如果您单击一个链接,该链接将变为红色并转到锚点部分。
即使使用滚动,我也想激活链接。有谁知道怎么做?
让我担心的另一件事是,当链接为红色时,当我点击页面的其他部分时,链接再次变为白色。
我正在使用基金会。
javascript - 如何相对于其中心移动 div(如锚点)?
当我将鼠标拖到一个 div 上时,我希望该 div 在它像锚点一样居中后调整大小,但我不知道如何。默认情况下,“锚点”设置在左上角
这是一个例子:
nsview - NSView 不绕中心旋转
我正在尝试围绕其中心旋转 NSView。但即使我更改了锚点,NSView 也会继续围绕其左上角旋转。只是一个精度:我正在使用 OSX 10.8.5。
在此先感谢您的帮助。
这是我的代码:
编辑 30-11-2018 :我设法使用图层获得居中旋转:
qt - How to anchor different things based on a property?
I desire a QML layout that looks something like this:
In other words, alternate objects (a QML Item in this case) are placed above or below some central line and the things they contain (QML Text) within those objects need to go to either the top or the bottom of the object.
Now I know I can align specific things with anchors on the items:
but that will set the item bottom anchor regardless of whether it's needed (such as with the second object above containig Text 2
).
What I'm actually looking for is a way to set only one anchor depending on the position. In psuedo-QML, that would be:
In other words, I only want to anchor the item bottom to parent bottom if it's above the line. Otherwise I want to anchor the item top to the parent top.
I thought it may be something like:
but nothing
does not appear to be an anchoring option :-)
Is there a way to do this with QML?
javascript - 如何根据嵌套元素的锚点使div居中
我有一个复杂的交互式 SVG 图形。在该图形中有一个特定的图标,假设它是信息图中的特定人物图标。此外,SVG 为 2000x2000 像素。这意味着在桌面(横向布局)上,它可能需要从顶部和底部剪掉一些以适应屏幕。在移动设备(纵向模式)中,它需要从右侧和左侧剪掉一些。鉴于此,我希望 SVG 以该人为中心,并在横向模式下剪辑顶部/底部,在纵向模式下剪辑左/右。这实现了两个目标:
- 图像始终以那个人为中心。
- 图像总是完全填满可用空间,无论是横向还是纵向模式。
想知道如何做到这一点。如果它必须用 JavaScript 完成,或者如果它可以纯粹用 CSS 完成。
此外,这个 SVG 不能加载到 CSS 的背景图像中,因为它是交互式的。它是普通的 SVG。
为了简化问题,我们可以说我们有<div>
一堆嵌套元素。我们希望这个 div 基于它包含的一些嵌套元素居中。因此,这似乎需要某种 JavaScript。也就是说,在窗口调整大小或方向更改时,获取我们想要居中的元素的偏移量,然后弄清楚如何将其调整为居中,然后从中找出如何调整 parent.parent.parent ......等等。直到您到达要在该点锚定的主包装器 div。然后我们将那个 div 移动多少。所以看起来这需要JavaScript,但我不知道,也许有一种方法可以用纯CSS来完成。
想知道是否可以演示如何在 JS 或 CSS 中执行此操作。
这是我到目前为止所拥有的。
请注意(https://imgur.com/PnugEin)在移动设备上它没有正确填充空间。黑盒应始终位于中心,整个 SVG 应缩放以覆盖整个视口,同时将黑盒保持在中心。
更新:好的,通过添加媒体查询来解决“填充视口”问题。最后一件事是如何根据矩形/锚点将其居中。
javascript - 打开另一个页面并滚动到锚点
我目前正在链接到同一页面上的锚点,下面的代码通过滚动效果实现了这一点。但是,我想将锚点放在不同的页面上。
我想要的是,当我单击按钮(.ebooks-button)时,它会打开页面并向下滚动到锚点。
这是我目前正在使用的代码。任何人都可以建议修改 javascript 来帮助我实现这一目标吗?
});