Jump to content
Larry Ullman's Book Forums

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


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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...