RestructuredText - adding title attributes to links

强颜欢笑 提交于 2019-12-04 05:44:56

I assume (try it out!), the title attribute is no longer needed by lightbox after lightbox is initialized. So if you'd like to provide the images alt-attributes as title, this one should do so, if you call it after lightbox-initialization:

function alt_2_title () {
    $("img[alt]").each(function(){
        $(this).attr('title', $(this).attr('alt'));
    });
});

This copies alt to title for every image that has an alt-attribute; If you like to modify only a few images, you might restrict you images selection by using something like ...

function alt_2_title (name_of_container) {
    $("img[alt]", "#"+name_of_container).each(function(){
        $(this).attr('title', $(this).attr('alt'));
    });
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!