Slider with views(?)

Asked

Viewed 70 times

1

At the bottom of the site I have a view call:

<?php $this->load->view('frontend/'.$this->domain.'/services/box_crm'); ?>

She is the description of a service: inserir a descrição da imagem aqui I left the content out of focus for customer privacy.

But now the customer wants to add their other services in the same place, with a slider, which would look something like this:

inserir a descrição da imagem aqui

I left the content out of focus for customer privacy.

The question: How can I make this slider by calling the views instead of images? When I click to pass it loads the next view, and so on. It is possible to do this?

  • This would have to be done on the client side, and therefore I don’t think it’s possible. Which framework is using?

  • Codeigniter. I already have all the views ready here, I just need to create the slider with them

  • I believe it is enough to use a slider that supports HTML in slides, such as jssor, and repeat this view generation code, one for each view you want to add to the slider.

1 answer

1


I decided as follows:

<script type="text/javascript">

        function simpleSlider(type){
            var sliderActive = $("#slider .sliderActive");
                if(type == 'prev') {
                    var sliderPrev   = sliderActive.prev().length ? sliderActive.prev() : $("#slider li:last");
                    sliderPrev.addClass('sliderActive').fadeIn();
                } else {
                    var sliderNext   = sliderActive.next().length ? sliderActive.next() : $("#slider li:first");
                    sliderNext.addClass('sliderActive').fadeIn();
                }
                sliderActive.removeClass('sliderActive').fadeOut();
            }
        $(function(){
            $("#slider li:first").fadeIn();

        });
    </script>

  <div class="buttons">
<a href="javascript:simpleSlider('prev')"><img src="assets/frontend/img/services/seta_esquerda.png"></a><a href="javascript:simpleSlider('next')"><img src="assets/frontend/img/services/seta_direita.png"></span></a>
</div>

<ul id="slider">
        <li class="sliderActive"><?php $this->load->view('frontend/'.$this->domain.'/services/box_crm'); ?></li>
        <li><?php $this->load->view('frontend/'.$this->domain.'/services/box_landing'); ?></li>
        <li><?php $this->load->view('frontend/'.$this->domain.'/services/box_seo'); ?></li>
        <li><?php $this->load->view('frontend/'.$this->domain.'/services/box_rastreator'); ?></li>

</ul>
  • 1

    I believe you will not pass any parameter to view so I advise to use <?php include ""; ?>

  • Thanks for the tip! But I use Codeigniter, and it has this very similar function to include. https://ellislab.com/codeigniter/user-guide/libraries/loader.html

  • you are getting referendum to $this->load->file('filepath/filename', true/false)? Because I used and did not know this function, thanks for the tip.

  • 1

    I say the function $this->load->view('name', $data, true/false) See here : https://ellislab.com/codeigniter/user-guide/general/views.html

Browser other questions tagged

You are not signed in. Login or sign up in order to post.