Part of the EllisLab Network
   
 
super Fast anchor_popup() alternative - Does it work on the Macs?
Posted: 28 March 2007 10:00 AM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  632
Joined  12-26-2006

Hi All,

I eventually tamed Pagination and the Form Class so that it remembers the last Input value (by using a SESSION variable).

Next step I tried was the anchor_popup() and discovered that it was sluggish and also required Java().
 
 
Here is the super fast CSS alternative.

a.popjoke  div   {display:none;}
    a
.popjoke:hover  div
        { display
:block; position:absolute;
          
top:020px; left:200px; z-index:1123;
          
width:560px; height:520px; overflow:auto;
          
background:#aff NONE; color:#000;
          
border:solid #909090 4px; margin:0; padding:0.8em}

 
 
The Controller

foreach ($query->result() as $row):
            
$memo = $this->m_lib->getjoke($row->id);
            
$data['thejoke'][] = "<a class='popjoke' href='#'>"
                                   
.$row->title .' [' .$row->id .']'
                                 
."<div>&nbsp; $memo</div></a>";
          endforeach;

/* THE SLOW JAVA() EQUIVALENT

          foreach ($query->result_array() as $row):
            $atts = array(
                          'width'      => '800',
                          'height'     => '600',
                          'scrollbars' => 'yes',
                          'status'     => 'yes',
                          'resizable'  => 'yes',
                          'screenx'    => '300',
                          'screeny'    => '300',
                          'title'      => $row['title']
                        );
            $data['thejoke'][] = anchor_popup( 'joke/popup/' .$row['id'],
                                              $row['title'] .' [' .$row['id'] .']',
                                              $atts);

*/

 
 
View

echo "<div class='bmp' style='line-height:1.8em;'>";
                
$zebra = false;
                foreach(
$thejoke as $row):
                  
$xxx    =  $zebra ? 'bgy' : 'bgg';
                  
$zebra  = ! $zebra;
                  echo
"<p class='bmp " .$xxx ."'>";
                    echo
br(0) .$row .br(0);
                  echo
'</p>';
                endforeach;

 
I have tested this using IE5, IE7, Modzilla, Firefox, Opera and Maxthon browsers and curious to know if it works on the Mac.
 
You can see it in action here or try using the bottom Search Text Box.

 Signature 

Joke of the day     (ongoing development site)

My Hippy Trail    Source code   

Latest Project

Profile
 
 
Posted: 28 March 2007 11:16 AM   [ Ignore ]   [ # 1 ]  
Grad Student
Avatar
Rank
Total Posts:  59
Joined  11-13-2006

It works fine on my Mac (OS X 10.4.9 G4) in:

* Safari 2.0.4
* Camino 1.0b2
* Firefox 1.5.0.11
* Opera 8.54

It doesn’t work in IE 5.2 (nothing pops up at all) but I wouldn’t sweat that. Mac users have pretty much long since abandoned IE since MS did. You’ve got the major browsers covered.

Profile
 
 
Posted: 28 March 2007 12:11 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  351
Joined  07-25-2006

FYI, this is generally called an “inline popup”, because it does not actually open a new window. Lightbox (and Graybox, Slimbox, etc) all use a method like this (although they still use JS).

 Signature 

me and some random code, hosted by dh. and a blog too! ++ dead bugs

Profile
 
 
Posted: 28 March 2007 01:13 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  104
Joined  03-02-2007

You can’t properly scroll in Firefox using the scrollbar, you have to click a point or use the arrows.

Besides that, I wouldn’t call this an “alternative” as this is way different than a regular popup, both in looks and purpose. Your popup is good for displaying short lengths of text, whereas a “real” popup is better for opening new pages (ie: for payment gateways) or similar.

Oh, and there’s no JAVA in the above code. You’re probably thinking about JavaScript wink

 Signature 

- Dragon Silhouette - Rebecca Kemp
- Conceptivator.com
- Hamachidota.com

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120442 Total Logged-in Users: 41
Total Topics: 126530 Total Anonymous Users: 6
Total Replies: 665324 Total Guests: 355
Total Posts: 791854    
Members ( View Memberlist )