I am using the bxSlider in full screen (filling entire browser window) mode. To have the images become full screen I set the images in the list as background-image: url images. I created this in html and it worked out fine. The images reach full width. Here is an example of what my HTML looks like:
<ul class="bxslider">
<li style="background-image: url('slide1.jpg');"></li>
<li style="background-image: url('slide2.jpg');"></li>
<li style="background-image: url('slide3.jpg');"></li>
<li style="background-image: url('slide4.jpg');"></li>
</ul>
Now, I want to incorporate it into expressionengine by allowing the admin to upload the slider images in the backend in the corresponding channel entry. I have created the channel fields labeled "slider_image1", "slider_image2", "slider_image3", "slider_image4" in the channel named, "slider_test." I am using expresionengine v2.6.1
I have been struggling for the correct markup and have tried the following which has not worked:
<ul class="bxslider">
{exp:channel:entries channel="{slider_test}"}
<li style="background-image: url({slider_image1});"></li>
<li style="background-image: url({slider_image2});"></li>
<li style="background-image: url({slider_image3});"></li>
{/exp:channel:entries}
</ul>
Any help would be appreciated. I also would like to include an if statement so that if the user only uploads two images the third one won't display.
I also would like to see if its also possible to incorporate the title="" element which the bxSlider uses as the captions. I know that the title element is meant for the html element so would love some ideas as to how this can be done.
I have changed the code to
<ul class="bxslider">
{exp:channel:entries channel="slider_test" dynamic="no"}
<li style="background-image: url({slider_image1});"></li>
<li style="background-image: url({slider_image2});"></li>
<li style="background-image: url({slider_image3});"></li>
{/exp:channel:entries}
</ul>
this still isn't working
My title for my channel entry is, "slider images" I have changed it to
<ul class="bxslider">
{exp:channel:entries channel="slider_test" dynamic="no" limit="1"}
{slider images}
<li style="background-image: url({slider_image1});"></li>
<li style="background-image: url({slider_image2});"></li>
<li style="background-image: url({slider_image3});"></li>
{/exp:channel:entries}
</ul>
Still isn't working. Thank you again for your patience. The status of the entry is open, The URL title for the channel entry is "slider-images"
It works this way but this isn't what I want because I am trying to set the images as backgrounds:
<ul class="bxslider">
{exp:channel:entries channel="slider_test" dynamic="no" limit="1"}
{slider images}
<li>{slider_image1}</li>
<li>{slider_image2}</li>
<li>{slider_image3}</li>
{/exp:channel:entries}
</ul>
This just sets the images inside the li. How do I set the li as background images while still allowing the user to choose what image to upload?
Can anyone help me figure this out?
As suggest for debugging I used:
{exp:channel:entries channel="slider_test" dynamic="no" limit="1"}
<pre>{slider_image1}{url}{/slider_image1}</pre>
{/exp:channel:entries}
I am getting a valid URL for the file in the PRE tag by removing setting the image as background. But I want them set as background.
Again, thank you all so much for helping me out with this. I really do appreciate it. As I'm sure you can tell by now I am still fairly new with expressionengine.
So, I have removed the ul li all together and tried using a div and setting the background image as suggested with the following markup:
{exp:channel:entries channel="slider_test" dynamic="no" limit="1"}
{slider images}
<div style="width:100%;height:100%; background-image: url('{slider_image1}{url}{/slider_image1}')">
{/exp:channel:entries}
The output is rather strange. The image does not appear as a background image rather in the css says this: background-image: url( '< p > < img alt= ;
This url:
http://www.financialadvisorycorp.com/slider_full_width
contains this code:
{exp:channel:entries channel="slider_test" dynamic="no" limit="1"}
<div style="width:100%;height:100%; background-image: url('{slider_image1}{url}{/slider_image1}')">
{/exp:channel:entries}
And This url:
http://www.financialadvisorycorp.com/slider_full_width_image
contains this code:
{exp:channel:entries channel="slider_test" dynamic="no" limit="1"}
<pre>{slider_image1}{url}{/slider_image1}</pre>
{/exp:channel:entries}
I would love to figure out how to set the slider images as backgrounds
<div style="width:100%;height:100%; background-image: url('{slider_image1}{url}{/slider_image1}')"> </div>
This is basically applying the background-image as style to an empty div. if this works you'll need to debug the styling on your<li>
elements (have you used thebackground:
short hand CSS rule with!important
ergo forcing the ignore of your inline style? also make sure you at least have an
in your<li>
's to avoid collapsing stuff.