0

I want to display single image on front-end by using matrix module. when I am uploading 2 image in slider I can see both image in slider but if i upload single image i can not see image at front-end.It display nothing.So Can you please help me to resolve this issue.

{exp:channel:entries channel="page" dynamic="yes"}
    {middle_slider}
        <div class="item" style="background-image: url('{slide_image}');">
            {if hide_one_page_middle_slider_quot == "No"}
                <img alt="img" src="{site_url}/assets/images/quote-left.png">
            {/if}
            {slide_content}
            {author}
        </div>‌
    ​{/middle_slider} 
{/exp:channel:entries}
6
  • Can you show us an example of your code? When you view source, is the path to the image correct and does the image actually exist on the server? First determine that the matrix field is outputting correctly. The display issue may be something else entirely.
    – Jim Wyse
    Jan 7 '16 at 13:06
  • @jim : but when i am uploading 2nd image it will work perfect slider i can see both image and slider also working fine. following code i am using {exp:channel:entries channel="page" dynamic="yes"}{middle_slider}<div class="item" style="background-image: url('{slide_image}');">{if hide_one_page_middle_slider_quot == "No"}<img alt="img" src="{site_url}/assets/images/quote-left.png">{/if}{slide_content}{author}</div>{/middle_slider} {/exp:channel:entries} Jan 7 '16 at 13:38
  • If the slider content is not dependent on the URL, set dynamic="no"
    – Jim Wyse
    Jan 7 '16 at 14:05
  • Check the html code: do you see the image url? If yes: which slider do you use? Do you have javascript errors? Jan 8 '16 at 9:32
  • @jim I have tried dynamic="no" but it is not working Jan 8 '16 at 14:46
0

Owl carousel will give you an error if you have 1 item and use loop=true. Add onInitialize to check how many items the carousel contains. If the carousel has 1 or less items, set loop to false:

$('.owl-carousel').owlCarousel({
    loop:true,
    onInitialize: function (event) {
        if ($('.owl-carousel .item').length <= 1) {
           this.settings.loop = false;
        }
    }
  })

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.