开发者

About Fancybox and PHP Mysql Adding <br /> or new line in the title

开发者 https://www.devze.com 2023-02-18 19:38 出处:网络
is there a way to to add <br /> in the title?? cause i want to add something from another table data..

is there a way to to add <br /> in the title??

cause i want to add something from another table data..

here's my code

 title="'.$row['prod开发者_如何学JAVAuct_name'].'" >' ...

for example product_name is "Ben What" product_desc is "Yeah Come at me"

i want to add some description in the title.. i don't want it to be connected in the title i want to add break line but somehow it won't work.

the output should be

Ben What 
Yeah Come at me

not

Ben What Yeah Come at me

Thank you! i tried alot but it won't work.


It looks like you're talking about the title attribute in an HTML tag.

HTML attributes attributes can not contain HTML themselves.

Some browsers let you put newlines in there using HTML entities, but you should not do this because of spotty support.


Your best best is going to be using the titleFormat callback that Fancybox describes to perform some variety of transformation on the title attribute.


i was having this problem too, so this is my solution, in the default configuration of fancybox change:

        $("a[rel=example_group]").fancybox({
            'transitionIn'      : 'none',
            'transitionOut'     : 'none',
            'titlePosition'     : 'over',
            'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
                return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
            }
        });

To this one:

        $("a[rel=example_group]").fancybox({
            'transitionIn'      : 'none',
            'transitionOut'     : 'none',
            'titlePosition'     : 'over',
            'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
                return '<span id="fancybox-title-over">' + title + '</span>';
            }
        });

This way you can use HTML in fancybox title attribute:

<a rel="example_group" href="./example/9_b.jpg" title="Lorem <br/> ipsum dolor sit amet"><img alt="" src="./example/9_s.jpg" /></a>

Note the
inside of the title attribute.

This is the configuration that you can do with fancybox as @Charles talk about it.


Instead using <br/> you can use <p>blah blah</p>, this way i fixed my problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消