A
A
agent11562017-01-20 12:04:14
Yii
agent1156, 2017-01-20 12:04:14

How to correctly write the path to the image in yii2?

At the end of the template page in layouts I have a script

$('.parallax-window').parallax({imageSrc: '/img/bg.jpg'});

How to specify path to @web/img file?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-01-20
@qonand

$('.parallax-window').parallax({
    imageSrc: <?=\yii\helpers\Url::toRoute(['/img/bg.jpg']);?>
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question