简体   繁体   English

在它链接到的下一页的相同位置打开一个 img 锚链接

[英]Opening an img anchor link at the same location in the next page it is linking to

I'm very new at this website making stuff so I'm not sure if I'm using the correct terms - I have tried googling with a bunch of different terms/ideas/wording and I'm not finding anything to help me ask the question more clearly or find examples of what I want我在这个网站上制作东西很新,所以我不确定我是否使用了正确的术语 - 我试过用谷歌搜索一堆不同的术语/想法/措辞,但我没有找到任何帮助我问的东西问题更清楚或找到我想要的例子

I have an img tag that is an anchor - clicking the image opens a new page (not a new tab, stays in original tab)我有一个 img 标签,它是一个锚点 - 单击图像会打开一个新页面(不是新标签,保留在原始标签中)

I would like the next page that opens with the to open to the exact location of the img tag.我希望打开的下一页打开到 img 标签的确切位置。 I tried using the <a id="">, <a href="#id"> thing but I'm not sure if it isn't working bc the "text" that would normally be in the <a> is actually an <img>我尝试使用<a id="">, <a href="#id">东西,但我不确定它是否不起作用 bc 通常在<a>的“文本”实际上是一个<img>

I am trying to create a flip-book style type thing with extremely limited javascript knowledge - I have some javascript that makes it look like you are "turning a page" (just flipping it on the y axis) on the img itself, but when you click the img to go to the next page it just loads at the top of the page and looks messy (have to scroll down to see the img again, and click again)我正在尝试创建一个具有极其有限的 javascript 知识的翻书样式类型的东西 - 我有一些 javascript 使它看起来像是在 img 本身上“翻页”(只是在 y 轴上翻转它),但是当您单击 img 转到下一页,它只是在页面顶部加载并且看起来很乱(必须向下滚动才能再次看到 img,然后再次单击)

Including the html/javascript but let me know if more info is needed!包括 html/javascript,但如果需要更多信息,请告诉我!

<!--this is the page-flip javascript-->
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="../flip-master/dist/jquery.flip.min.js"></script>
   
<script>
    $(function()
    $(".flip").flip({
    trigger: 'click'});});
</script>
<main class="flip">
    <div class="front">
    <img src="../images/sketchbook3.jpg" alt="sketchbook page">
    </div> <!--this is where i would like the page to open to upon loading, 
the idea being clicking on the page "opens" to the next page, until the end 
of the "book" . each flip is two images on one page, there are multiple pages
to make up the book-->

    <div class="back">
    <a href="sketchbook3.html"><img src="../images/sketchbook4.jpg" alt="sketchbook page with click to next page"></a>
    </div> 
</main>
```

Use a hash in the href URL:href URL 中使用哈希:

<a href="sketchbook3.html#imgid">

Where imgid is the ID of the element that you want to scroll to on the sketchbook3.html page.其中imgid是要滚动到该元素的ID sketchbook3.html页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM