+ Reply to Thread
Results 1 to 3 of 3

Thread: onresize and Firefox

  1. #1
    fomalhaut is offline x10Hosting Member fomalhaut is an unknown quantity at this point
    Join Date
    Aug 2009
    Location
    South of France near Arles
    Posts
    91

    onresize and Firefox

    Hello.

    I've a problem with onresize on the Firefox browser: I've a list in a table. This table is defined in a "div" tag. Depending on the height of my window, I want only the "div" to be scrollable, not the whole document, because in fact, there will be other elements above it:

    PHP Code:
    <?php session_start(); 
    include (
    '../inc/functions.php');
    include (
    '../inc/DB_Connect.inc'); // with $dbh          
    require ('../inc/gesJardin_insert.inc');
    ?>
    <html><head>
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    <META HTTP-EQUIV="EXPIRES" CONTENT="-1">
    <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
    <title>Gestion du site jardin</title>
    <script type="text/javascript" src="../Jardin.js"></script>
    <link rel=stylesheet href="../jardin.css" type="text/css">
    </head>
    <body id="body">
    <div class="flot"><center>
    <a name="liste"></a>
    <div id="lstEven" style="overflow:auto;" onresize="visibleHeight()">
      <script type="text/javascript">
      visibleHeight();
      </script>
      <table style="text-align:center;" border='1'><caption>
      <form action="gesJardin.php#liste" id="liste" method="post"> <!-- Raffraichissement de la liste des évènements -->
        <b>Liste des &eacute;v&egrave;nements</b>&nbsp;
        <input type="submit" name="raffrListe" id="raffrListe" value="Raffra&icirc;chir la liste" style="background-color:cyan" />
       </form>
       </caption>
       <tr><th>Date</th><th>S&eacute;q</th><th>Titre</th><th>Nom fichier photo</th></tr> <!-- le commentaire sera dessous avec un aperçu photo -->
    <?php
    require ('../inc/evenements_liste.inc');
    ?>
       </table>
    </div>
    </center>
    </div>
    <br /><a href="../index.php" style="position:relative; z-index:+999">Retour au menu</a><br /><br />
    <!--<input type="button" onclick="deconnect()" class="deconnect" value="d&eacute;connexion" />
    <br />-->
    <?php
    include('../inc/gesJardin.inc'); //that's code for take data from DBase mySQL
    ?>
    <br />
    </body>
    </html>
    Code:
    function visibleHeight(id) {
    if (!id) {id = "lstEven";}
    var top = document.getElementById(id).offsetTop;
    var winH = window.document.body.clientHeight;
    var hauteurLibre = winH - top - 15;  //205 / 74;
    document.getElementById(id).style.height = hauteurLibre;
    //alert('id='+id+' top='+top+' winH='+winH+' hauteurLibre='+hauteurLibre+' '+id+'.height='+document.getElementById(id).style.height+' //');
    }
    When the document loads, no problem, the visibleHeight function works fine. But on resize, it does nothing. I've tried the "onresize" condition on the "body" tag, it's the same. I've tried a first script with
    Code:
    window.onresize = visibleHeight();
    it's the same! And if I add a "setTimeout" before the function, it works only one time, at the document load! I've tried replace onresize condition by other too, such onscroll, or onmouseover, and in these cases, all works fine !

    I don't know what to do for onresize !

    thank you for help.

    ---------- Post added at 06:39 AM ---------- Previous post was at 06:36 AM ----------

    ... and naturely, when I clic the "raffrListe" input button, making a "reload" it works too.

  2. #2
    essellar's Avatar
    essellar is offline Community Advocate essellar has a spectacular aura about
    Join Date
    Feb 2010
    Location
    Toronto, Ontario, CA
    Posts
    1,153

    Re: onresize and Firefox

    Why not simply make a headr div with position: fixed; pinned to the top of the browser and scroll the rest of the page? All CSS; no JavaScript needed.
    “Beware of bugs in the above code; I have only proved it correct, not tried it.” --Donald Knuth
    "It was as if its architects were given a perfectly good hammer and gleefully replied, 'neat! With this hammer, we can build a tool that can pound in nails.'" -- Alex Papadimoulis (on TheDailyWTF.com)

  3. #3
    fomalhaut is offline x10Hosting Member fomalhaut is an unknown quantity at this point
    Join Date
    Aug 2009
    Location
    South of France near Arles
    Posts
    91

    Re: onresize and Firefox

    Thank you, Essellar, for that very simple, but very good idea ! I've changed my page as you said. It works fine, and it seems the same I wanted !

    But the "onresize" that don't works with Firefox is a problem I'd like to resolve... one of these days !

    thanks again.

+ Reply to Thread

Similar Threads

  1. Hide spread firefox in firefox but show in IE
    By taha116 in forum Programming Help
    Replies: 8
    Last Post: 07-13-2009, 11:44 AM
  2. Firefox 3
    By intertec in forum Off Topic
    Replies: 6
    Last Post: 06-18-2008, 04:43 PM
  3. is there a diff between mozilla firefox and mozilla, firefox?
    By aquila in forum Scripts & 3rd Party Apps
    Replies: 4
    Last Post: 11-15-2007, 07:12 AM
  4. Help with FireFox
    By Colin in forum Off Topic
    Replies: 9
    Last Post: 02-07-2006, 08:53 AM
  5. Firefox: Using Firefox for Beginners
    By pulse__xx in forum Tutorials
    Replies: 9
    Last Post: 11-26-2005, 07:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers