I'm using bootstrap and by default the font is 1rem when I click the print button it does not take the default size of the document it takes a very small font to mount the increase and decrease font button I'm using a jquery Jfontsize will have something to hinder it from getting the right font size.
Can anyone help me?
$('a, p, h1, h2, h3, h4, h5, h6, img, figcaption, footer, span, li, ul, ol, td, th, tr').jfontsize({
btnMinusClasseId: '#jfontsize-m2',
btnDefaultClasseId: '#jfontsize-d2',
btnPlusClasseId: '#jfontsize-p2',
btnMinusMaxHits: 1,
btnPlusMaxHits: 3,
sizeChange: 5
});
jquery.jfontsize-2.js
(function($) {
return $.fn.jfontsize = function(opcoes) {
var $this, apply, current_size, defaults, save;
$this = $(this);
defaults = {
btnMinusClasseId: "#jfontsize-minus",
btnDefaultClasseId: "#jfontsize-default",
btnPlusClasseId: "#jfontsize-plus",
btnMinusMaxHits: 10,
btnPlusMaxHits: 10,
sizeChange: 1
};
if (opcoes) {
opcoes = $.extend(defaults, opcoes);
}
save = function() {
return $.jStorage.set("jfontsize", current_size);
};
apply = function() {
return $this.each(function(i) {
var fontsize, size;
if (!($(this).data("initial_size") != null)) {
fontsize = $(this).css("font-size");
fontsize = parseInt(fontsize.replace("px", ""));
$(this).data("initial_size", fontsize);
}
size = $(this).data("initial_size") + (current_size * opcoes.sizeChange);
return $(this).css("font-size", size + "px");
});
};
$(opcoes.btnMinusClasseId + ", " + opcoes.btnDefaultClasseId + ", " + opcoes.btnPlusClasseId).removeAttr("href");
$(opcoes.btnMinusClasseId + ", " + opcoes.btnDefaultClasseId + ", " + opcoes.btnPlusClasseId).css("cursor", "pointer");
current_size = $.jStorage.get("jfontsize", 0);
if (current_size === (-opcoes.btnMinusMaxHits)) {
$(opcoes.btnMinusClasseId).addClass("btn-secondary disabled");
}
if (current_size === opcoes.btnPlusMaxHits) {
$(opcoes.btnPlusClasseId).addClass("btn-secondary disabled");
}
apply();
$(opcoes.btnMinusClasseId).click(function() {
$(opcoes.btnPlusClasseId).removeClass("btn-secondary disabled");
if (current_size > (-opcoes.btnMinusMaxHits)) {
current_size--;
if (current_size === (-opcoes.btnMinusMaxHits)) {
$(opcoes.btnMinusClasseId).addClass("btn-secondary disabled");
}
apply();
return save();
}
});
$(opcoes.btnDefaultClasseId).click(function() {
$(opcoes.btnMinusClasseId).removeClass("btn-secondary disabled");
$(opcoes.btnPlusClasseId).removeClass("btn-secondary disabled");
current_size = 16;
$this.each(function(i) {
return $(this).css("font-size", $(this).data("initial_size") + "px");
});
return save();
});
return $(opcoes.btnPlusClasseId).click(function() {
$(opcoes.btnMinusClasseId).removeClass("btn-secondary disabled");
if (current_size < opcoes.btnPlusMaxHits) {
current_size++;
if (current_size === opcoes.btnPlusMaxHits) {
$(opcoes.btnPlusClasseId).addClass("btn-secondary disabled");
}
apply();
return save();
}
});
};
})(jQuery);