Is there any way I can give a control a custom ID or Class name? I know that the controls have an ID that consists of a bunch of letters and numbers but I don;t really want to use these in my CSS.
Thanks,
Is there any way I can give a control a custom ID or Class name? I know that the controls have an ID that consists of a bunch of letters and numbers but I don;t really want to use these in my CSS.
Thanks,
Dear ,
the "Name" property in k2 control's property is an ID , u could use it to apply specific styling for a specific control .
for example wt i have , is custom styling for my label that is title , i set its name to lbltitle
and in my css its like this ,
#lbltitle, span[name="lbltitle"]{ font-size:24px!important; margin:10px 0px!important; color:#333!important;}
This css will change any label u use that its name is "lbltitle"
Hope it helps ,
Regards.
@
My Smart Forms do not appear to be working like that for some reason. I have the name property of the control set like so:
The name property is not seen anywhere. Any ideas what I'm doing wrong?
Thanks,
Hi Reece,
No, You are not missing anything, it's just the name property for the picture control is not available but some other controls have the name property.
Darn that's disappointing... I wonder why image controls don't have this functionality? Thanks for your replies though!
Hi Reece,
it's not related to K2, this is by design in HTML:
Quick comparison between two tags attributes (a tag & img tag)
Oh I understand what you are refering to now, the actual name HTML attribute. I was under the impression that K2 takes what you enter in the name property and uses that as the ID to allow you to apply custom CSS. E.g. a image name 'Logo1' would have the id: '#Logo1' at runtime. Thanks for the clarification!
As a side note, it would be pretty neat if K2 allowed you to assign additional class names to a control :)
Hi Reece,
Is there a reason why you're not using the default class?
you can change the class name using JS or Jquery.
set this as an expression on a data label:
<script type="text/javascript"> $(document).ready(function()
{
$('.picture-control-inline').toggleClass('picture-control-inline NewClassName');
});
</script>
wish this helps
@
An example scenario is adding two images to a smart form and then giving the first image an id (or class) of #image1 and then the other image the id of #image2. I could then use css to apply different behaviors to each image. E.g.
#image1 {
width: 200px;
}
#image2 {
cursor:pointer;
}
Whereas if I simply target .picture-control-inline, the behavior will apply to all images.
Thanks for the reply!
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.