Forum

Thread tagged as: Question, Problem, Forum

Slide Nav Items

Hi there,

I am having difficulties showing the dotnav for my slider items i have created using Perch.

Here is my code:

 <perch:before>
                <ul class="uk-slideshow uk-grid uk-grid-width-1-3">
            </perch:before>
            <perch:repeater id="gallery" label="Portfolio Slider Images" order="6">
                <li class="">
                    <img src="<perch:content type="image" id="image" label="Portfolio Image" order="1" />" alt="<perch:content type=" text" id="alt" label="image alt text (SEO)" order="2" />" />
                </li>
                <perch:after>
                    </ul>
                </perch:after>
            </perch:repeater>
            <a href="" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous" data-uk-slideshow-item="previous"></a>
            <a href="" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next" data-uk-slideshow-item="next"></a>
            <ul class="uk-dotnav uk-dotnav-contrast uk-flex-center uk-margin-top">
                <li data-uk-slideshow-item="0">
                    <a href=""></a>
                </li>
                <li data-uk-slideshow-item="1">
                    <a href=""></a>
                </li>
            </ul>

You will notice data-uk-slideshow-item, this is the dotnav for the sliders. I need this to display based on the number of slider items.

After looking at perch_item_zero_index i thought i could just add it like follows:

<ul class="uk-dotnav uk-dotnav-contrast uk-flex-center uk-margin-top">
                <li data-uk-slideshow-item="<perch:content id="perch_item_zero_index" type="hidden" />">
                    <a href=""></a>
                </li>
            </ul>

Is there something i am missing?

Regards Alex

Alec Sharples

Alec Sharples 0 points

  • 6 years ago

HI Robert,

This seems to only display one dotnav when i have three sliders :(

That is what i have as a template in /content.

Regards Alex

Hi Robert,

Thank you very much for you help so far!

I did try your code without any luck :(

I have added that to my template but it still only show one, I'm not sure what i am doing wrong here. I am sure its something silly.

Alex

This is the current code for my slider in the portfolio_item.html template

Im just wondering how the dotnav has a relationship with the slider to show the number of slides

<div class="uk-grid uk-flex uk-flex-middle uk-margin-bottom uk-margin-top" data-uk-grid-margin>
    <div class="uk-width-medium-1-1 uk-flex-middle">
        <div class="uk-slidenav-position" data-uk-slideshow="{autoplay:true}">
            <perch:before>
                <ul class="uk-slideshow uk-grid uk-grid-width-1-3">
            </perch:before>
            <perch:repeater id="gallery" label="Portfolio Slider Images" order="6">
                <li class="">
                    <img src="<perch:content type="image" id="image" label="Portfolio Image" order="1" />" alt="<perch:content type=" text" id="alt" label="image alt text (SEO)" order="2" />" />
                </li>
                <perch:after>
                    </ul>
                </perch:after>
            </perch:repeater>
            <a href="" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous" data-uk-slideshow-item="previous"></a>
            <a href="" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next" data-uk-slideshow-item="next"></a>
            <perch:before><ul class="uk-dotnav uk-dotnav-contrast uk-flex-center uk-margin-top"></perch:before>
    <li data-uk-slideshow-item="<perch:content id="perch_item_zero_index" type="hidden" />">
        <a href=""></a>
    </li>
<perch:after></ul></perch:after>
        </div>
    </div>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you explain the logic with your before and after sections? They seem to be placed randomly.

@Robert Then how would one add multiple slide items with a single image?

I am using Perch CMS not Runway.

@Drew, i am unsure what you mean. I have a slider using so the before and after are used to show the slides.

I thank you both for your input so far :)

Regards

Robert,

I did manage to find the following post: https://forum.grabaperch.com/forum/11-08-2014-problem-with-dynamic-sliders

But again i cant seem to get this to work :(

If it works i would be VERY grateful of the help :)

It was the content custom name "Slides" that confused me, where does that relate to the slider items?

Robert,

I can't thank you enough for the support you have given me, I now have the slider dotnav working. AMAZING :)

I have not explained myself clearly and I can only apologise, I am using this slider in a portfolio and the slider is showing different parts of our latest brand Identity for clients work we have completed.

I have uploaded to a test server: https://fineline-new.fineline-websolutions.co.uk/detail/conwy-goat-meat

You will notice I create many portfolio items with this slider but your time and effort on the code you passed over on Git is for a single item :(

Please forgive me, this advanced side of Perch is new to me and I have only spent a short time with the docs and your help :)

Kind Regards

Robert Ketter said:

Alec, The code I created for you was for a new region, you can put unlimited images in the region. When you use the perch_content_custom() function it will echo EVERY image in that region.

While it may not be exactly what you need, it should be a really good starting point.

I will look at the link you posted and see if it inspires another idea for me.

Robert Ketter

Hi Robert,

I have already picked up a lot from your code, that has not been wasted. I am struggling to get that region into my portfolio items on each unique portfolio page.

Thank you sir!

I am really struggling here to get a simple slider into one of my portfolio items, the bottom navigation dotnav is killing me HAHA.

@Robert has been fantastic and has invested time, I managed to get the slider dotnav working but not as a repeater item for the images.

Has anyone else run into this issue?

Regards

Drew McLellan

Drew McLellan 2638 points
Perch Support

This is a long and confusing thread. What's the current issue?

Hi Drew,

My bad I'm sorry :(

If you take a look at the following link: https://fineline-new.fineline-websolutions.co.uk/detail/conwy-goat-meat

You see a large slider with three slides, at bottom of the slider (The square dotnav) I would like that to update based on the number of slides I have added but there is no way to add a multi region of slides images and the dotnav update due to the limitations of the repeater region.

Please note I add many portfolio items but can't work out how to add many images and the dotnav update per item.

Regards

Drew McLellan

Drew McLellan 2638 points
Perch Support

Would you not just use the repeater a second time to output the nav?

Drew McLellan said:

Would you not just use the repeater a second time to output the nav?

How does the dotnav know it belongs to the slide items when using a repeater? That is the issue we have.

Regards

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't understand.

<perch:repeater id="slides">
 ... output slides ...
</perch:repeater>
<perch:repeater id="slides">
 ... output nav ...
</perch:repeater>

Drew McLellan said:

I don't understand.

<perch:repeater id="slides">
... output slides ...
</perch:repeater>
<perch:repeater id="slides">
... output nav ...
</perch:repeater>

Drew, it was the ID that fixed this all for me, thank you :)