<p>Given that your assets are within an entry, it seems that a gallery browsing mechanism may fit well. I'd suggest a javascript framework such as Fancybox: <a href="http://fancyapps.com/fancybox/" rel="nofollow noreferrer">http://fancyapps.com/fancybox/</a> </p>

<p>Alternatively and perhaps more in line with your specific question, have a look at this related thread: <a href="https://craftcms.stackexchange.com/questions/14755/best-way-to-access-getprev-and-getnext-asset-fields">Best way to access getPrev and getNext asset fields</a></p>

CC BY-SA 3.0
2016-06-30T23:18:26.587Z
2016-06-30T23:18:26.587Z
2017-04-13T12:51:00.303Z
Matt P
<p>I'm looking to create a way to navigate to the next/previous image in an entry's asset range and display only the current asset at one time(starting from first asset).</p>

<pre><code>{% extends '_layout.html' %}

{% block main %}


&lt;div class="tr"&gt;
    {{ entry.title }}
  &lt;/div&gt;

  &lt;div class="row nav"&gt;
        &lt;a href="{{ siteUrl }}"&gt;&lt;span class="name"&gt;Emily Ashcroft&lt;/span&gt;&lt;/a&gt;

    &lt;a class="head" href="{{ siteUrl }}comm.html"&gt;Commissions&lt;/a&gt;
    &lt;a class="head" href="{{ siteUrl }}port.html"&gt;Portraits&lt;/a&gt;
    &lt;a class="head" href="{{ siteUrl }}pers.html"&gt;Personal&lt;/a&gt;
    &lt;a class="head" href="{{ siteUrl }}CV.html"&gt;Info&lt;/a&gt;

    &lt;/div&gt;


&lt;!-- left side of window links to previous image if there is one, right side links to next image or asset if there is on --&gt;

&lt;a href="{{ siteUrl }}"&gt;&lt;div class="left"&gt;&lt;/div&gt;&lt;/a&gt;

&lt;a href="{{ siteUrl }}"&gt;&lt;div class="right"&gt;&lt;/div&gt;&lt;/a&gt;

&lt;div class="container"&gt;

&lt;!-- output current asset only --&gt;

        {% for photo in entry.photos %}
  &lt;div class="row"&gt;
      &lt;div class="centre"&gt;
         &lt;img id="slider" src="{{ photo.first.getUrl() }}" /&gt;
      &lt;/div&gt;
  &lt;/div&gt;

  {% endfor %}

  &lt;/div&gt;
{% endblock %}
</code></pre>

<p>Click on left side of screen and the previous asset is displayed, click on the right and the next asset is output. I'm struggling to figure if I should use a method similar to paginating links to next/prev entries (but I don't think that would work for assets).</p>

<p>This code is taken from _entry.html page of a section.</p>

<p>Thanks for any help provided.</p>

<assets><assetfilemodel>
Next/Previous Asset or Image within Entry
# Next/Previous Asset or Image within Entry

(Asked by: username_0 on 2016-06-30)

I'm looking to create a way to navigate to the next/previous image in an entry's asset range and display only the current asset at one time(starting from first asset).
{% extends '_layout.html' %}

{% block main %}



    {{ entry.title }}
  

  
        Emily Ashcroft

    Commissions
    Portraits
    Personal
    Info

    












        {% for photo in entry.photos %}
  
      
         
      
  

  {% endfor %}

  
{% endblock %}

Click on left side of screen and the previous asset is displayed, click on the right and the next asset is output. I'm struggling to figure if I should use a method similar to paginating links to next/prev entries (but I don't think that would work for assets).
This code is taken from _entry.html page of a section.
Thanks for any help provided.

**Tags:** assets, assetfilemodel


---

## 1 answers

### Answer by username_1 on 2016-06-30. Score: 1

Given that your assets are within an entry, it seems that a gallery browsing mechanism may fit well. I'd suggest a javascript framework such as Fancybox: <http://fancyapps.com/fancybox/>

Alternatively and perhaps more in line with your specific question, have a look at this related thread: [Best way to access getPrev and getNext asset fields](https://craftcms.stackexchange.com/questions/14755/best-way-to-access-getprev-and-getnext-asset-fields)


---

