Changeset 1526283
- Timestamp:
- 11/01/2016 09:16:26 PM (9 years ago)
- Location:
- responsive/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (4 diffs)
-
responsive.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
responsive/trunk/readme.txt
r1383363 r1526283 1 === responsive ===1 === Responsive === 2 2 3 3 Contributors: Dejan Batanjac … … 5 5 Requires at least: 3.0 6 6 Tested up to: 4.5 beta 7 Stable tag: 1. 07 Stable tag: 1.1.0 8 8 9 9 Resizes any non responsive web site, and makes it responsive with the simple trick of CSS scaling achieved using jQuery 10 10 11 11 == Description == 12 This simple WordPress plugin inserts smart jQuery code to your website header and makes old, non-responsive web sites automatically responsive. It doesn't use Bootstrap, nor any responsive grid system. 12 This simple WordPress plugin inserts smart jQuery code to your website header and makes old, non-responsive web sites automatically responsive. It doesn't use Bootstrap, nor any responsive grid system. 13 13 14 14 The only requirement is JavaScript (jQuery) being enabled in your browser. If no JavaScrpt enabled, then the plugin will not have any impact. … … 16 16 == Installation == 17 17 18 1. Upload `responsive` folder to the `/wp-content/plugins/` directory19 1. Activate the plugin through the 'Plugins' menu in WordPress18 1. Upload the plugin 19 1. Activate the plugin 20 20 21 21 … … 27 27 == Changelog == 28 28 29 30 = 1.1.0 = 31 Tabs into spaces. 32 29 33 = 1.0 = 30 31 34 Initial version -
responsive/trunk/responsive.php
r1383363 r1526283 1 1 <?php 2 /* 3 Plugin Name: Responsive 4 Plugin URI: http://programming-review.com/ 5 Description: Can make your theme responsive without any effort 6 Author: Dejan Batanjac 7 Version: 1.0 8 Author URI: http://programming-review.com/ 9 License: GPLv2 or later 10 11 */ 12 2 /** 3 * Plugin Name: Responsive 4 * Plugin URI: http://programming-review.com/ 5 * Description: Will make your theme responsive without any effort 6 * Author: Dejan Batanjac 7 * Version: 1.1.0 8 * Author URI: https://programming-review.com/ 9 * License: GPLv2 or later 10 */ 11 if ( ! class_exists( 'Responsive' ) ) : 13 12 class Responsive { 14 13 15 /*--------------------------------------------* 16 * Constants 17 *--------------------------------------------*/ 18 const name = 'responsive'; 19 const slug = 'responsive'; 20 21 /** 22 * [__construct makes sure jQuery h/b added] 23 */ 24 function __construct() { 14 // Constants 15 const NAME = 'responsive'; 16 const SLUG = 'responsive'; 25 17 18 ////////////////////////////////////////////////// 19 // Constructor makes sure jQuery will be added. // 20 ////////////////////////////////////////////////// 21 function __construct() { 26 22 27 add_action( 'wp_enqueue_scripts', 'please_add_jquery' ); 28 function please_add_jquery() { wp_enqueue_script( 'jquery' ); } 29 23 add_action( 'wp_enqueue_scripts', 'add_jquery' ); 24 function add_jquery() { 25 wp_enqueue_script( 'jquery' ); 26 } 30 27 31 //hook to wp_head 32 add_action('wp_head',array( &$this, 'draw_' )); 28 add_action( 'wp_head', array( &$this, 'draw_' ) ); 33 29 30 } // End constructor(). 34 31 35 } 32 /////////////////////////////////// 33 // Main JavaScript resize script // 34 /////////////////////////////////// 35 function draw_() { 36 ?> 37 <script> 36 38 37 /** 38 * [draw_ Scales with factor X] 39 * @return [bool] [true] 40 */ 41 function draw_(){ 42 ?> 43 <script> 39 jQuery(window).resize(function() { 40 safescale(); 41 }); 42 jQuery(document).ready(function() { 43 jQuery(window).trigger('resize'); 44 jQuery(window).trigger('resize'); 45 }); 44 46 45 jQuery(window).resize(function() { 46 safescale(); 47 });48 jQuery(document).ready(function() { 49 jQuery(window).trigger('resize');50 jQuery(window).trigger('resize'); 47 function scale(factor_x){ 48 jQuery('html').css("transform","scale("+factor_x+","+factor_x+")"); 49 jQuery('html').css("-moz-transform","scale("+factor_x+","+factor_x+")"); 50 jQuery('html').css("-webkit-transform","scale("+factor_x+","+factor_x+")"); 51 jQuery('html').css("-o-transform","scale("+factor_x+","+factor_x+")"); 52 } 51 53 52 }); 54 function safescale(){ 53 55 56 factor_x = jQuery(window).width() / jQuery('body').width() ; 54 57 55 function scale(factor_x){ 56 jQuery('html').css("transform","scale("+factor_x+","+factor_x+")"); 57 jQuery('html').css("-moz-transform","scale("+factor_x+","+factor_x+")"); 58 jQuery('html').css("-webkit-transform","scale("+factor_x+","+factor_x+")"); 59 jQuery('html').css("-o-transform","scale("+factor_x+","+factor_x+")"); 60 } 58 jQuery("html").css({"position": "absolute", "margin": "0px", "padding": "0px"}); 59 jQuery("body").css({"position": "absolute", "margin": "0px", "padding": "0px"}); 60 scale(factor_x); 61 } 62 </script> 61 63 62 function safescale(){ 63 64 factor_x = jQuery(window).width() / jQuery('body').width() ; 65 66 jQuery("html").css({"position": "absolute", "margin": "0px", "padding": "0px"}); 67 jQuery("body").css({"position": "absolute", "margin": "0px", "padding": "0px"}); 68 scale(factor_x); 69 } 70 </script> 71 72 <?php 73 return true; 74 } 64 <?php 65 return true; 66 } 75 67 76 68 77 69 } // end class 70 endif; 71 78 72 new Responsive(); 79 80 ?>
Note: See TracChangeset
for help on using the changeset viewer.