[Code] Thêm nhiều font chữ cho trình soạn thảo

Xem chủ đề cũ hơn Xem chủ đề mới hơn Go down

[Code] Thêm nhiều font chữ cho trình soạn thảo Empty [Code] Thêm nhiều font chữ cho trình soạn thảo

Bài gửi by HelpsFMvi Fri Jun 24, 2016 12:31 am


Demo:

[You must be registered and logged in to see this link.]

Hướng dẫn:

1. Tạo 1 trang JS(Javascript) mới 

Titile: Add more fonts in editor
Place: In all the pages

Code:
$(function(){$(function() {
  $('.sceditor-button-font').click(function() {
    addFont('Calibri');
    addFont('Papyrus');
    addFont('Copperplate');
    addFont('Avantgarde');
   
    $('.sceditor-font-option.new-font').click(function(e){$('#text_editor_textarea').sceditor('instance').insertText('[font='+$(this).attr('data-font')+']','[/font]');$('.sceditor-font-picker').remove();e.preventDefault()})
  });
  function addFont(font){$('.sceditor-font-picker div').append('<a unselectable="on" class="sceditor-font-option new-font" href="#" data-font="'+font+'"><font unselectable="on" face="'+font+'">'+font+'</font></a>')}
})});

2. Các thêm font mới:

Muốn thêm font mới các bạn chỉ cần thêm một đoạn này vào là OK
Ví dụ mình muốn thêm font Baskerville thì chỉ cần thêm đoạn này:
Code:
addFont('Baskerville');
vào bên dưới những đoạn:
Code:
addFont('Calibri');
    addFont('Papyrus');
    addFont('Copperplate');
    addFont('Avantgarde');

là được Very Happy

HelpsFMvi
HelpsFMvi
Ban Quản Trị FMvi
Ban Quản Trị FMvi


Số bài : 104
HelpsPoints : 15528
Likes : 33
Ngày tham gia : 10/03/2016
Trạng thái :
Online
Offline

Tuổi : 26
Location : Ninh Thuận
Google Chrome
Phpbb3

[Click để xem tài sản HelpsFMvi]

https://helps.forumvi.com

Về Đầu Trang Go down

Xem chủ đề cũ hơn Xem chủ đề mới hơn Về Đầu Trang

- Similar topics

 
Permissions in this forum:
Bạn không có quyền trả lời bài viết
Create a forum on Forumotion | ©phpBB | Free forum support | Báo cáo lạm dụng | Thảo luận mới nhất
Stylish responsive footer | Script Tutorials