久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

jquery dotdot 插件(添加省略號)不適用于 Bootstrap 輪

jquery dotdotdot plugin (adds ellipsis) not working with Bootstrap carousel(jquery dotdot 插件(添加省略號)不適用于 Bootstrap 輪播)
本文介紹了jquery dotdot 插件(添加省略號)不適用于 Bootstrap 輪播的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在為我的 Rails 4 應用程序使用 Bootstrap 3 輪播.為了截斷輪播中較長的字幕,我使用了 jquery dotdotdot 插件,該插件還在末尾附加了...".雖然該插件適用于輪播中的第一張圖片,但不適用于后續圖片.

I'm using the Bootstrap 3 carousel for my Rails 4 application. To truncate longer captions in the carousel, I'm using the jquery dotdotdot plugin which also appends "..." at the end. While the plugin works for the first image in the carousel, it doesn't work for subsequent images.

這是 jsfiddle:http://jsfiddle.net/michaelvli/GD3JH/9/

Here's the jsfiddle: http://jsfiddle.net/michaelvli/GD3JH/9/

為什么 dotdotdot 沒有在輪播的所有字幕上執行?我嘗試使用輪播事件處理程序在每次輪播滑動時執行插件,但此解決方案不適合,因為在 dotdotdot 有機會執行之前,用戶會在短時間內看到完整的標題:

Why is dotdotdot not executing on all captions of the carousel? I've tried using a carousel event handler to execute the plugin every time the carousel slides but this solution isn't suitable as the user will see the full caption for a brief moment before dotdotdot has had a chance to execute:

$('.carousel').on('slide.bs.carousel', function () {
    $('.dotdotdot').dotdotdot({});
});

或者,如果有人可以推薦另一種解決方案,即截斷多行字幕,同時在末尾附加...",那也很棒.

Alternatively, if somebody can recommend another solution that truncates multi-line captions while appending a "..." to the end, that would be great too.

推薦答案

問題在于,由于它沒有顯示所有項目,因此沒有在每個項目的末尾應用 ...,那些隱藏沒有激活.為了解決這個問題,我們將所有項目都設置為 active item 類,以便顯示它們,然后將除第一張幻燈片(或元素 0)之外的所有項目切換到 item.再次隱藏它們.所以我們可以添加這個:

The problem is that since it is not showing all items it's not applying the ... at the end of each, the ones hidden are not activating. To solve this we have all items to be the class active item so they are shown then switch all but the first slide (or element 0) to item. To hide them again. So we can add this:

$( ".active.item" ).each(function( index ) {
    if(index != 0){
        $(this).removeClass('active');
    }
});

現在我們所有的項目都受到點點的影響.

Now we have all the items affected properly by the dotdotdot.

小提琴這里

這篇關于jquery dotdot 插件(添加省略號)不適用于 Bootstrap 輪播的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

jQuery/JavaScript Library for avatar creation?(用于創建頭像的 jQuery/JavaScript 庫?)
How to do following mask input problem?(如何做以下掩碼輸入問題?)
Issues Setting Value/Label Using DropKick Javascript(使用 DropKick Javascript 設置值/標簽的問題)
how to unit-test private methods in jquery plugins?(如何對 jquery 插件中的私有方法進行單元測試?)
stellar.js - configuring offsets / aligning elements for a vertical scrolling website?(stellar.js - 為垂直滾動網站配置偏移量/對齊元素?)
jQuery masked input plugin. select all content when textbox receives focus(jQuery 屏蔽輸入插件.當文本框獲得焦點時選擇所有內容)
主站蜘蛛池模板: 国产一区二区三区四区三区四 | 日韩高清黄色 | 国产在线精品一区 | 久久精品91| 亚洲国产看片 | 在线成人av| 成人h免费观看视频 | 国产高清一区二区三区 | 亚洲欧洲成人av每日更新 | 国产精品毛片无码 | 亚洲精品视频一区 | 蜜臀久久99精品久久久久野外 | 日韩午夜一区二区三区 | 中文字幕日韩欧美一区二区三区 | 黑人巨大精品欧美一区二区免费 | 欧美日韩视频在线播放 | 亚洲精品一区二区三区蜜桃久 | 免费黄色片在线观看 | 夜夜草 | 香蕉大人久久国产成人av | 18性欧美| 色婷婷一区二区三区四区 | 日韩精品一区二区三区视频播放 | 日韩成人在线免费观看 | 欧美炮房 | 亚洲精品9999 | 毛片黄片免费看 | 国产精品久久一区二区三区 | 国产免费观看久久黄av片涩av | 久久噜噜噜精品国产亚洲综合 | 粉嫩粉嫩芽的虎白女18在线视频 | 国产一二三区免费视频 | 国产高清精品一区二区三区 | 国产成人精品一区二区三区网站观看 | 天堂成人国产精品一区 | 欧美激情一区二区三区 | 亚洲二区视频 | 亚洲成人免费 | 欧美日韩精品免费观看 | 中文字幕高清在线 | 国产精品色 |