Jump to content
Larry Ullman's Book Forums

[Solved]How To Set The Path For The Slider Background Images In Javascript File


soopers
 Share

Recommended Posts

Hello guys.
I am using a revolution slider in my project, in which the background images of the slider are set using javascript code.
So how can I set the path for that images because currently it is not displaying once I have convert the theme into yii.

 

here is javascript code that I have paste in main layout file.


            jQuery(document).ready(function () {
                window.slider_bg = {"ind": 0, // index to start sliding at
                    "source": ["<?php echo Yii::app()->theme->baseUrl; ?>/pic/slider/bg_slide1.jpg", //replace these slides with your own ones
                        "<?php echo Yii::app()->theme->baseUrl; ?>/pic/slider/bg_slide2.jpg",
                        "<?php echo Yii::app()->theme->baseUrl; ?>/pic/slider/bg_slide3.jpg",
                        "<?php echo Yii::app()->theme->baseUrl; ?>/pic/slider/bg_slide4.jpg"],
                    "bg_container": jQuery("#bg_container"),
                    "bg_substrate": jQuery("#bg_substrate")};
                window.slider_bg.bg_container.css("background-image", "url(" + window.slider_bg.source[window.slider_bg.ind] + ")");
            });
        

the above code work fine on local server, but doesn't work on online server. 

How can I solve this ?
Thanks in advance. 

Link to comment
Share on other sites

 Share

×
×
  • Create New...