Bug reports Found a bug? Post it here please.
Version 7.x > Bug reports > Content Slider Style doesn't apply View modes: 
User avatar
Member
Member
mosgath - 7/2/2013 11:27:10 AM
   
Content Slider Style doesn't apply
I am attempting to use the Content Slider. I set the "Style" of the Div tag in the control to "nofContentSlider". However, it does not add the style to any div tag in the page. I just adds the default width and height. I checked the code for the control and the DivStyle property is never used. I need to be able to give the div tag my own style as we want it to be responsive based on percentage of parent's size, not a static pixel size.

Below is what gets generated:

<div class="Content" id="p_lt_zoneContent_phContent_p_lt_ctl00_ContentSlider" style="height: 300px; overflow-x: hidden; overflow-y: hidden; position: relative; left: 0px; width: 400px; ">


I am using version 7.0.24.

User avatar
Member
Member
kentico_sandroj - 7/2/2013 12:37:16 PM
   
RE:Content Slider Style doesn't apply
Hello,

The style property just adds a style tag, so if you added nofContentSlider to that property, this is how it would render: <div style="nofContentSlider"></div> which is not valid CSS. You can either wrap the slider in a div using the HTML Envelope or target the already existing ID/Class. If you delete the "Div options" properties, are the width and height still rendered on the page?

-Sandro

User avatar
Member
Member
mosgath - 7/2/2013 12:47:58 PM
   
RE:Content Slider Style doesn't apply
Ok. I cleared both the width, height, and style values and click ok. When I go back into the web part, the width and height have been defaulted in. The rendered page also shows the defaulted values. Since it is defaulting in, I can't override it with the CSS style.

User avatar
Member
Member
mosgath - 7/2/2013 12:52:57 PM
   
RE:Content Slider Style doesn't apply
Also, if I type in "width: 100%;height: 100%;" in the style box, it does not appear anywhere in the rendered html. In the control ascx.cs file, DivStyle property is not being used to generate any html.

User avatar
Member
Member
kentico_sandroj - 7/2/2013 1:05:39 PM
   
RE:Content Slider Style doesn't apply
Hi,

Thank you for the additional clarification, I see what the issue is now. It appears that the values were hardcoded in the Web part. Even if I delete the values and set my own style, the hard-coded values are used. You could correct this by modifying the Web part:

~\CMSWebParts\Viewers\Effects\ContentSlider.ascx.cs

   #region "Div properties"

/// <summary>
/// Gets or sets the DIV element width.
/// </summary>
public int DivWidth
{
get
{
return ValidationHelper.GetInteger(GetValue("DivWidth"), 400);
}
set
{
SetValue("DivWidth", value);
}
}


/// <summary>
/// Gets or sets the DIV element height.
/// </summary>
public int DivHeight
{
get
{
return ValidationHelper.GetInteger(GetValue("DivHeight"), 300);
}
set
{
SetValue("DivHeight", value);
}
}


/// <summary>
/// Gets or sets the DIV element style.
/// </summary>
public string DivStyle
{
get
{
return ValidationHelper.GetString(GetValue("DivStyle"), "");
}
set
{
SetValue("DivStyle", value);
}
}


/// <summary>
/// Style options.
/// </summary>
private string StyleOptions
{
get
{
return mStyleOptions ?? (mStyleOptions = "width: " + DivWidth + "px; height: " + DivHeight + "px; overflow: hidden; position: relative; left: 0px;");
}
}

#endregion


Adjusting these values should be a functional workaround but I will discuss this with the developers and see if there is anything else that should be done for the Web part to work as expected.

Regards,
Sandro