GithubHelp home page GithubHelp logo

widgetresponsivecarouselyii2's Introduction

Очень легкий виджет для формирования карусели Yii2, c минимумом настроек

Реализована возможность вывода от 1 до n объектов одновременно (multiCarousel).

За основу взят скрипт https://github.com/basilio/responsiveCarousel#responsivecarousel

Также используется хелпер Image от https://github.com/noumo/easyii

По умолчанию каталоги helpers и widgets расположены в app\components

Можно выводить как картинки, так и блоки текста и видео. Демо от автора скрипта responsivecarousel : http://basilio.github.io/responsiveCarousel/#examples

Пример вызова виджета для формирования карусели c картинками

$carousel = ResponsiveCarousel::widget([
'items' => Carousel::items(),
'size' => $data_slider, // $data_slider['width'] = ... $data_slider['height'] = ...
]);

Где items - это массив c объектами карусели, c публичными свойствами image, title, text, link

Size - массив c элементами width и height. Виджет проверяет соответствие картинок карусели переданным размерам, если размеры картинок не соответствуют width и height - они обрезаются

Пример вызова виджета для формирования карусели c текстовыми блоками, кол-во блоков в ряду - 4

ResponsiveCarousel::widget([
    'image' => false,
    'containerOptions' => [
        'id' => 'rewiews_main'
    ],
    'jsOptions' => [
        'visible' => 4,
        'itemMinWidth' => 200,
        'itemMargin' => 15,
        //'autoRotate' => 7000,
        'speed' => 1000,
    ]
])

В этом случае, кроме всего остального, мы передаем виджету id 'rewiews_main' уже сформированного блока, например

<div id="reviews-title">
    <h3 style="text-align: center;">Header</h3>
    <a href="#" class="previous"><i class="fa fa-chevron-left"></i></a>
    <a href="#" class="next"><i class="fa fa-chevron-right"></i></a>
</div>
<div id="rewiews_main" class="crsl-items" data-navigation="reviews-title">
    <div class="crsl-wrap">
        <? foreach ($last_reviews as $reviews) : ?>
            <section class="crsl-item">
	    		<?= reviews->text ?>
            </section>
        <?php endforeach ?>
    </div>
</div>

Подробности про формирование html разметки и передаваемых параметрах на http://basilio.github.io/responsiveCarousel/#examples

widgetresponsivecarouselyii2's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.