473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Alignment problem in webpage on screen resolution change

Hi,
I created a textsizer in css and jquery. The purpose of this is,
1. on webpage there is a link called "textsize", when you click a popup is shown and it contains 3 options (increase font, decrease font and reset font).

I had aligned my pop up box according to the screen resolution 1024 X 768, when i change the screen or system resolution to lower or higher the css alignment is not proper.

Please find the css, html and jquery code.
Expand|Select|Wrap|Line Numbers
  1. /* starting of textsize */
  2. li a.textTool:hover, li a.textToolActive { 
  3.     background:#0063be url('../Images/tools/text-on.gif') -1px 0px no-repeat;
  4.     color:#ffffff;
  5.     text-decoration:none;
  6.     height:25px;
  7. /*    width:55px; */
  8.     margin-top:0px;
  9.     background-color:#0063be;
  10. }
  11.  
  12.  
  13. .text-tool {
  14.     position:absolute;
  15.     left:704px;
  16.     width:125px;
  17.     top:228px;
  18.     right:260px;
  19.  
  20.         -moz-box-shadow: 3px 3px 4px #000;    
  21.     -webkit-box-shadow: 3px 3px 4px #000;     
  22.     box-shadow: 3px 3px 4px #000;    
  23.     /* For IE 8 */    
  24.     -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000')";    
  25.     /* For IE 5.5 - 7 */    
  26.     filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000');
  27. }
  28.  
  29. .text-tool .header { 
  30.     background:#0063be;
  31.     width:125px;
  32.     height:25px;
  33.     position:relative;
  34. .text-tool .header h5 { 
  35.     color:#fff;
  36.     padding:5px 0 12px 2px;
  37.     font-size:1.1em;
  38.     font-weight:bold;
  39. }
  40. .text-tool .header .close {
  41.     position:absolute;
  42.     top:10px;
  43.     right:10px;
  44.     cursor:pointer; 
  45. }
  46. .text-tool .body { 
  47.     background:#fff;
  48.     border-bottom:#ccc solid 1px;
  49.     border-right:#ccc solid 1px;
  50.     border-left:#ccc solid 1px;
  51.     padding:5px 15px 0 0px;
  52.     height:25px;
  53.     width:125px;
  54.     position:relative;
  55. .text-tool .body .a1{
  56.     display:inline;
  57.  
  58. }
  59. /* End of textsize section */
  60.  
Jquery code
Expand|Select|Wrap|Line Numbers
  1.  
  2.         $(" a.textTool").click(function () {
  3.             $('a.textTool').removeClass("textTool").addClass('textToolActive');
  4.             $('.text-tool').removeClass("hide");
  5.         });
  6.  
  7.         $(".text-tool li.email a").click(function () {
  8.             $('.text-tool .body').animate({ height: "305px" }, 650, function () {
  9.                 $('.text-tool .body .text-tool-email').fadeIn(200);
  10.             });
  11.  
  12.         });
  13.  
  14.             $(".text-tool .close").click(function () {
  15.             $(' a.textToolActive').removeClass("textToolActive").addClass('textTool');
  16.             $('.text-tool').addClass("hide");
  17.             $('.text-tool .body .page-tools-email').css({ 'display': 'none' });
  18.             $('.text-tool .body').css({ 'height': '25px' });
  19.         });
  20.  
  21.  
  22. //Font sizer starts here
  23. $(" a.textTool").click(function () {
  24.             $('a.textTool').removeClass("textTool").addClass('textToolActive');
  25.             $('.text-tool').removeClass("hide");
  26.         });
  27.  
  28. $(document).ready(function(){
  29.                                //$(document).height(".page-tool .body"); // returns height of HTML document
  30.     var MaximumFontSize = 15;
  31.     var MinimumFontSize = 6;
  32.     var $currentObject = $(".threecoloumlayout").children(".column-2");
  33.  
  34.   // Reset Font Size
  35.   var originalFontSize = $currentObject.css('font-size');
  36.   $("#resetFont").click(function(event){
  37.     event.preventDefault();                             
  38.     $currentObject.css('font-size', originalFontSize);
  39.   });
  40.   // Increase Font Size
  41.   $("#increaseText").click(function(){
  42.     var currentFontSize = $currentObject.css('font-size');     
  43.     var currentFontSizeNum = parseFloat(currentFontSize, 10);
  44.        var newFontSize = currentFontSizeNum+1;
  45.     if (newFontSize < MaximumFontSize) {
  46.         $currentObject.css('font-size', newFontSize);
  47.     }    
  48.     return false;
  49.   });
  50.   // Decrease Font Size
  51.  
  52.      $("#DecreaseText").click(function(){
  53.       var currentFontSize = $currentObject.css('font-size');
  54.      var currentFontSizeNum = parseFloat(currentFontSize, 10);
  55.     var newFontSize = currentFontSizeNum-3;
  56.     //alert('currentFontSizeNum');
  57.     if (newFontSize > MinimumFontSize) {
  58.         $currentObject.css('font-size', newFontSize);
  59.     }
  60.     return false;
  61.   });
  62.  
  63.  
  64. });
  65. //Font sizer Ends here
  66.  
HTML code
Expand|Select|Wrap|Line Numbers
  1. <div class="text-tool hide">
  2.           <div class="header">
  3.             <h5>Text sizer</h5>
  4.             <div class="close"><img src="http://bytes.com/submit/images/tools/close.gif" width="10" height="10" alt="Close" title="Close" /></div>
  5.           </div>
  6.           <div class="body">
  7.           <div class="a1">
  8.           <a href="#" id="increaseText"><img src="http://bytes.com/submit/images/tools/BigA.jpg"/></a>
  9.           <a href="#" id="resetFont"><img src="http://bytes.com/submit/images/tools/textreset.jpg"/></a>
  10.              <a href="#" id="DecreaseText"><img src="http://bytes.com/submit/images/tools/smallA.jpg"/></a>
  11.           </div>
  12.  
  13.           </div>
  14.           </div>
  15.           </div>
  16.  
Please help out in solving this issue.
Dec 14 '10 #1
2 3044
JKing
1,206 Expert 1GB
Try using percentage based values for your absolute positioning instead.
Dec 14 '10 #2
Hi Jking,
Thanks for your reply. I tried with percentage but it's not working. Is there anything to do with the jquery code or something else can be done.
Dec 15 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: ZaGras | last post by:
when my vb program run on another computer instead of my computer, the user interface is biggger..this is because of the screen resolution... anyone know how to solve pls?
12
by: Dave | last post by:
About a week ago, I upped my screen resolution from 800x600 to 1024x768. From that point on, I started making gradual adjustments to my web site, in which the margins are tailored to 800 pixels...
4
by: pjac | last post by:
I need some help with some VB language that will change the screen resolution on a monitor when a MS-Access 2000 database is opened from 1024 x 768 to 800 x 600. Any help with this effort would be...
8
by: lauren quantrell | last post by:
Is there a way to force a change in a user's screen resolution using VBA code without having any input from the user? Example: User John Backwards has his screen set to 800 x 600 pixels. Backwards...
6
by: Darian | last post by:
I am wondering how (if it is possible of course) I can change a users screen resolution to a certain size when running my application and then change it back when they exit my application. For...
5
by: Maxi | last post by:
I have a 30X16 cells table in my html page. Table height and width are set to 100%. I have set size of every cell inside the table to 24 pixel. When I open the html page in maximize state in...
7
by: Norman Swartz | last post by:
I want to place some graphic images on the web that are optimally viewed at a resolution of 1024 by 768 pixels. Is it possible, within Javascript,to force a particular screen resolution?
9
by: Steve Wright | last post by:
Hi I'm developing a webpage that needs to include a different stylesheet depending on the screen resolution. I know that I could read the resolution in javascript and then do some sort of...
1
by: nasima khan | last post by:
Hi, i am nasima. I have got a code for setting the screen resolution of my page, but i am unable to understand. Can any one give a complete data explanation of the below code. Sub ChangeRes(X...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.