2014-02-15, 04:24 AM
I have a script that auto-zooms the page (works great) just put this in the header template start:
However some users don't like this and prefer a non-zoomed page old style. I don't care either way but got to satisfy users.
The only way to get this to work that I know of is on page load in header, is there anyway I could have a feature to turn this on/off and save per user?
I was suggested to create a theme, but then I realized, themes only allow CSS changes.
Then I realized I could create a seperaet template and link that theme to that template without the code. However there ought to be a better way other than me having to export/import the theme each time i make changes for a seperate non-zoom version (if you know what i mean)
<script type="text/javascript">
jQuery.noConflict();
jQuery(window).load(function() {
var currentWidth = jQuery(document.body).width();
var targetWidth = 1050; // experiment for your self
var scrollWidth = 10; // need to make it dynamic
// if the screen is not bigger than the target, then don't mess with zooming
if (currentWidth > targetWidth) {
if (typeof document.body.style.zoom != "undefined")
document.body.style.zoom = currentWidth / targetWidth;
else if (typeof document.body.style.MozTransform != "undefined") {
document.body.style.MozTransformOrigin = "left top";
document.body.style.MozTransform = 'scale(' + currentWidth / targetWidth + ')';
}
else if (typeof document.body.style.WebkitTransform != "undefined")
document.body.style.WebkitTransform = 'scale(' + currentWidth / targetWidth + ')';
jQuery(document.body).width(targetWidth - scrollWidth);
}
});
</script>
However some users don't like this and prefer a non-zoomed page old style. I don't care either way but got to satisfy users.
The only way to get this to work that I know of is on page load in header, is there anyway I could have a feature to turn this on/off and save per user?
I was suggested to create a theme, but then I realized, themes only allow CSS changes.
Then I realized I could create a seperaet template and link that theme to that template without the code. However there ought to be a better way other than me having to export/import the theme each time i make changes for a seperate non-zoom version (if you know what i mean)