-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
31 lines (23 loc) · 956 Bytes
/
app.js
File metadata and controls
31 lines (23 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$( () => {
$('.toggleButton').hover(function() {
$(this).toggleClass('btn-hover');
});
$('.toggleButton').click(function() {
$(this).toggleClass('active');
const $panelID = $(this).attr('id') + '-panel';
$('#' + $panelID).toggleClass('hidden');
const $activeCount = 4 - $('.hidden').length;
$('.panel').width(($(window).width() / $activeCount) - 10);
});
$('textarea').on('change keyup paste', function() {
updateOutput();
})
const updateOutput = function() {
$('iframe').contents().find('html').html("<html><head><style type='text/css'>" + $('#css-panel').val() + "</style></head><body>" + $('#html-panel').val() + "</body></html>");
document.getElementById('output-panel').contentWindow.eval($('#javascript-panel').val());
};
//Page Load with Default 2 Active
$('.panel').height($(window).height() - $('nav').height() - 30);
$('.panel').width(($(window).width() / 2) - 10);
updateOutput();
});//