Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'alt' inside span

If 'alt' is inside 'span' would I need to change the following script

        function setNavi( $c, $i ) {
                var title = $i.attr( 'alt' );
                $('#title').text( title );

                var current = $c.triggerHandler( 'currentPosition' );
                $('#pagenumber span').text( current+1 );

            }

    $(function() {

        $('#carousel').carouFredSel({
            debug: true,
            responsive: true,
            circular: false,
            auto: true,
            prev: '#prev',
            next: '#next',
            items: {
                visible: 1,
                width: 200,
                height: '66%'
            },
            scroll: {
                onBefore: function( $oI, $nI ) {
                    setNavi( $(this), $nI );
                }
            },
                onCreate: function( $vI ) {
                    setNavi( $(this), $vI );
                }
            });

html:

<div id="carousel">
<span id="1"><img src="images/someimage.jpg"  alt="sometitle" /></span>
<span id="2"><img src="images/someimage2.jpg" alt="sometitle2" /></span>
</div>

<div id="navi">
 <p id="pagenumber">Now showing image <span></span> of 7.</p>
 <p id="title"></p>
</div>

the pagenumber is displaying correctly, but not the image title. also tried using 'title' instead of 'alt' but it still results in a blank title.

like image 688
user1184254 Avatar asked Mar 06 '26 11:03

user1184254


1 Answers

Yes, you would. alt is for images. Judging by the code, I'd say that the title attribute is a suitable alternative, and it will even show the same tooltip that alt does for images.

like image 90
Ry- Avatar answered Mar 09 '26 00:03

Ry-