Applying class to clickable DIV

Page: 1

Author Post
Member
Registered: Jun 2012
Posts: 2
I have the following code:
<div id="test" class="naked floatbox" onclick="fb.start({ href:&#039;#&#039; })" style="cursor:pointer;"><img src="test.svg"></div>


The above code works but it generates the default Floatbox visual style. How do I ensure that the Floatbox popup is styled with the "naked" class. Declaring a class on the DIV tag doesn't seem to work.

Thanks in advance. :)
Administrator
Registered: Aug 2008
Posts: 3382
That's a very old legacy syntax for the fb.start command. Let's use the simpler, current syntax. fb.start(source, options).

I wouldn't think a source of '#' would get you very far. That does not refer to a specific div. I would expect that to load the entire base page inside a floatbox - not likely what you're after.

Options go in the options parameter of the fb.start call (of all places). One available option is className, which has the equivalent effect as adding a classname to a starting anchor element.

Your fb.start call could look something like:
fb.start('#myDivId', 'className:naked');
Member
Registered: Jun 2012
Posts: 2
Admin,

THANK YOU!!!! I was overlooking the className option in the onClick declaration. It works now. 8)


PS - I just used the "#" symbol as a URL stand in so I wouldn't muddy the question with a HUGE url path. I tried to make the code as simple as possible. Looks like my thought process confused you more then it helped. Anyway, your response solved my issue. :D
« Last edit by MaloCS on Tue Jun 19, 2012 4:00 pm. »

Page: 1