Display background behind a floating element

0

Posted on : 19-11-2008 | By : Stefan | In : CSS

Ok… so you setup a page with a blue background and float an object left, for example. You now see that the background colour on the float is white! Ruining the look of your page.

<div id=”contentBody”>
<div style=”float: left;”>Floated Content</div>
</div>

So how do we do it? Use the following hack:

#contentBody:after { content: “.”; display: block; height: 0; clear: both; visibility: hidden; } * html #contentBody { height: 1%;}

Using JQuery with Other Libraries

0

Posted on : 19-11-2008 | By : Stefan | In : Javascript

I’ve just learend something very cool today. How to use JQuery with other libraries, in my case prototype.js.

The issue is where other libraries are using $ as the same shortcut, for example JQuery uses “$” as a shortcut for “JQuery”.

Here’s the workaround:

 <html>
 <head>
   <script src="prototype.js"></script>
   <script src="jquery.js"></script>
   <script>
     jQuery.noConflict();

     // Put all your code in your document ready area
     jQuery(document).ready(function($){
       // Do jQuery stuff using $
       $("div").hide();
     });

     // Use Prototype with $(...), etc.
     $('someid').hide();
   </script>
 </head>
 <body></body>
 </html>

For a full demo and explanation see: http://docs.jquery.com/Using_jQuery_with_Other_Libraries