JavaScript實(shí)現(xiàn)點(diǎn)擊按鈕字體放大、縮小
本文給大家分享js實(shí)現(xiàn)點(diǎn)擊按鈕字體放大縮小實(shí)例代碼,代碼簡(jiǎn)單易懂,需要的朋友參考下吧
具體代碼如下所示:
<style> .bb{color:red;} .cc{color:green;} .chapter {font-size: 1.5em;} .normal{font-size:12px;} .hidden{display:none;} </style> <script> $(document).ready(function() { $('div.aa').addClass('bb'); $('a[href^="http:"]').addClass('cc'); //$('#switcher-large').on('click',function(){ // $('div.large').addClass('chapter'); //}); $('#switcher-large').click(function(){ $('div.large').toggleClass('chapter'); $(this).toggleClass('bb'); }); //$('#switcher').click(function(){//點(diǎn)擊按鈕增加(移除)樣式(toggleClass方法) //$('#switcher button').toggleClass('hidden'); //}) //字體的放大縮小 var $biger = $('div.large'); var num = parseFloat($biger.css('fontSize')); $('#switcher-bigger').click(function(){ num=num*1.4; $biger.css('fontSize',num+'px'); }); $('#switcher-small').click(function(){ num=num/1.4; $biger.css('fontSize',num+'px'); }); }); </script> <div id="switcher" class="switcher"> <h3>Style Switcher</h3> <button id="switcher-default"> Default </button> <button id="switcher-hidden">Narrow hidden</button> <button id="switcher-large">Large Print</button> <button id="switcher-bigger">switcher-bigger</button> <button id="switcher-small">switcher-small</button> </div> <div class="large"> <p>腳本之家</p> <p>腳本之家</p> <p>腳本之家</p> <p>腳本之家</p> </div>
關(guān)于JavaScript實(shí)現(xiàn)點(diǎn)擊按鈕字體放大、縮小的相關(guān)知識(shí)就給大家介紹這么多,希望對(duì)大家有所幫助!
- js實(shí)現(xiàn)點(diǎn)擊圖片在屏幕中間彈出放大效果
- JS點(diǎn)擊縮略圖整屏居中放大圖片效果
- angularjs點(diǎn)擊圖片放大實(shí)現(xiàn)上傳圖片預(yù)覽
- 移動(dòng)端點(diǎn)擊圖片放大特效PhotoSwipe.js插件實(shí)現(xiàn)
- 手機(jī)端點(diǎn)擊圖片放大特效PhotoSwipe.js插件實(shí)現(xiàn)
- jquery插件jquery.LightBox.js實(shí)現(xiàn)點(diǎn)擊放大圖片并左右點(diǎn)擊切換效果(附demo源碼下載)
- JS實(shí)現(xiàn)點(diǎn)擊圖片在當(dāng)前頁(yè)面放大并可關(guān)閉的漂亮效果
- 原生JS實(shí)現(xiàn)京東查看商品點(diǎn)擊放大
相關(guān)文章
js 本地預(yù)覽的簡(jiǎn)單實(shí)現(xiàn)方法
本篇文章主要是對(duì)js本地預(yù)覽的簡(jiǎn)單實(shí)現(xiàn)方法進(jìn)行了介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助2014-02-02Flutter 超實(shí)用簡(jiǎn)單菜單彈出框 PopupMenuButton功能
這篇文章主要介紹了Flutter 超實(shí)用簡(jiǎn)單菜單彈出框 PopupMenuButton功能,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-08-08CSS鼠標(biāo)響應(yīng)事件經(jīng)過(guò)、移動(dòng)、點(diǎn)擊示例介紹
本文為大家介紹下CSS 鼠標(biāo)響應(yīng)事件:鼠標(biāo)經(jīng)過(guò)CSS、鼠標(biāo)移動(dòng)CSS、鼠標(biāo)點(diǎn)擊CSS以及示例,喜歡的朋友可以參考下2013-09-09使用canvas實(shí)現(xiàn)魔法攝像頭的示例代碼
我們用手機(jī)的攝像頭自拍,很容易實(shí)現(xiàn)簡(jiǎn)單的自拍效果,如復(fù)古、黑白等等,其實(shí)我們使用web端的JavaScript也是可以實(shí)現(xiàn)的,接下來(lái)就帶領(lǐng)小伙伴實(shí)現(xiàn)一個(gè)魔法攝像頭,并且提供了截圖下載功能,需要的朋友可以參考下2023-08-08firefox TBODY 用js顯示和隱藏時(shí)出現(xiàn)錯(cuò)位的解決方法
今天幫別人寫(xiě)一個(gè)網(wǎng)頁(yè),發(fā)現(xiàn):當(dāng)用javascript動(dòng)態(tài)設(shè)置tr.style.display = "block"顯示某行時(shí),使用IE瀏覽沒(méi)有問(wèn)題,但使用firefox瀏覽時(shí)該行被移到了其它行的后面,很是詫異。2008-12-12