M
M
Michael2019-03-10 21:15:54
JavaScript
Michael, 2019-03-10 21:15:54

How to set path to css file in js?

Hello everybody! The problem is the following, I did the layout and used the layerslider carousel, everything worked fine in the layout, I transferred the template to yiI2, connected all the scripts and styles, and the carousel stopped displaying, my suspicion falls on the skinsPath parameter, which specifies the path to the file with styles for the carousel to work. The question is how to correctly specify the path to the file with styles?

$('#layerslider').layerSlider({
    autoStart: true,
    responsive:true,
    responsiveUnder: 1280,
    layersContainer: 1280,
    hoverPrevNext: false,
    skin: 'fullwidth',
    skinsPath: '/css/skins/',
    showCircleTimer: false,
    hideOnMobile: false,
    navStartStop: false,
    navButtons: false
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2019-03-10
@slo_nik

Good evening.
Why not use AssetBandle? Connect all styles and js in it humanly and not suffer.
Although you can also use this option:

<?php
$url = Url::toRoute('path_to_css');
$thsi->registerJs("
$('#layerslider').layerSlider({
    autoStart: true,
    responsive:true,
    responsiveUnder: 1280,
    layersContainer: 1280,
    hoverPrevNext: false,
    skin: 'fullwidth',
    skinsPath: '" . $url . "',
    showCircleTimer: false,
    hideOnMobile: false,
    navStartStop: false,
    navButtons: false
});
", View::POS_END);
?>

Correct possible errors yourself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question