茄子在线看片免费人成视频,午夜福利精品a在线观看,国产高清自产拍在线观看,久久综合久久狠狠综合

    <s id="ddbnn"></s>
  • <sub id="ddbnn"><ol id="ddbnn"></ol></sub>

  • <legend id="ddbnn"></legend><s id="ddbnn"></s>

    純JS代碼實現(xiàn)氣泡效果
    來源:易賢網(wǎng) 閱讀:1963 次 日期:2016-07-06 10:02:58
    溫馨提示:易賢網(wǎng)小編為您整理了“純JS代碼實現(xiàn)氣泡效果”,方便廣大網(wǎng)友查閱!

    js氣泡效果,在項目需求中經(jīng)常遇到。今天小編把大概實現(xiàn)步驟分享到腳本之家平臺,感興趣的朋友可以參考下

    就不給大家多文字說明了。給大家梳理下關(guān)鍵步驟。

    關(guān)鍵步驟:

    1、引入js文件

    <script type="text/javascript" src="js/jquery.min.js"></script>

    <script type="text/javascript" src='js/jquery.thoughtBubble.js'></script>

    2、在需要使用氣泡效果的地方

    <div id='mainContainer' class='container'>

    <img src='ahout.JPG' id="thoughtBubble" alt='whats up?' />

    </div>

    3、使用氣泡效果

    <script type="text/javascript">

    $(window).ready( function() {

    $('#thoughtBubble').thoughtBubble({

    text: 'baby,I love you',

    font: 'avenir'

    });

    });

    4、這是jquery.thoughtBubblr.js代碼

    (function($) {

    $.fn.thoughtBubble = function( defaults ) {

    var settings = $.extend({

    backgroundColor: 'white',

    fontColor: 'black',

    width: '330px',

    height: '210px',

    fontSize: '15px',

    bubbleColor: 'white',

    speed: 125

    }, defaults ),

    getBubbleDiv = function( container ) {

    var offset = container.offset(),

    modifiedHeight = offset.top - parseInt( settings.height ),

    style = '"position: absolute; top:' + modifiedHeight + 'px; left:' + offset.left + 'px ; width:' + settings.width + '; height:' + settings.height + ';"',

    bubbleContainer = "<div class='bubble-holder' style=" + style + ">" + getMainBubble() + getBubbles() + "</div>";

    return bubbleContainer;

    },

    getMainBubble = function() {

    return '<div class="main-bubble-holder"><div class="bubble main-bubble">' + getText() + '</div></div>';

    },

    getText = function() {

    return '<span style="vertical-align: middle; color: ' + settings.fontColor + ';font-size: ' + settings.fontSize + '; font-family: ' + settings.font + '">' + settings.text + '</span>';

    },

    getBubbles = function() {

    return '<div class="sm-bubble-holder"><div class="bubble bubbleLg"></div><div class="bubble bubbleMd"></div><div class="bubble bubbleSm"></div></div>';

    },

    animate = function(){

    var bubbles = $(document).find('.bubble'),

    reversed = bubbles.get().reverse(),

    speed = settings.speed;

    $(reversed[0]).stop().animate({ opacity: 1}, speed, function() {

    $(reversed[1]).animate({ opacity: 1}, speed, function() {

    $(reversed[2]).animate({ opacity: 1}, speed, function() {

    $(reversed[3]).animate({ opacity: 1},speed);

    });

    });

    });

    },

    unanimate = function() {

    var bubbles = $(document).find('.bubble');

    bubbles.stop().animate({opacity: 0});

    },

    shiftDiv = function( container ) {

    var bubbleHolder = $(document).find('.bubble-holder'),

    previousPosition = container.offset().left;

    bubbleHolder.css('left', previousPosition);

    };

    return this.each( function() {

    var $this = $(this),

    container = getBubbleDiv( $this );

    $this.on('mouseenter', animate );

    $this.on('mouseout', unanimate );

    $(window).on('resize', shiftDiv.bind(this, $this) );

    return $this.parent().prepend(container);

    });

    };

    })(jQuery);

    以上給大家分享了js氣泡效果的關(guān)鍵步驟,代碼簡單易懂,就沒給寫過多的文字說明,大家有疑問歡迎給我留言,小編會及時回復(fù)大家的,在此小編也非常感謝大家對腳本之家網(wǎng)站的支持!

    更多信息請查看網(wǎng)絡(luò)編程
    易賢網(wǎng)手機網(wǎng)站地址:純JS代碼實現(xiàn)氣泡效果

    2026上岸·考公考編培訓(xùn)報班

    • 報班類型
    • 姓名
    • 手機號
    • 驗證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
    工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)