开发者

multiple jquery popups in cakephp

开发者 https://www.devze.com 2023-01-05 21:19 出处:网络
am showing a list of emails, and for each email on click, am trying to create a popup, to show the full email content....

am showing a list of emails, and for each email on click, am trying to create a popup, to show the full email content....

the prob is that, popup works only for 1st email, for rest it doent show anything,

here is my code,

foreach ($email as $x){

            echo "<div id='popuup_div' class='popup_msg'>";
            echo "<div id='image'>";
            echo $html->image('mail.png');
            echo "</div>";
            echo "<br>";
            echo $client['Email']['body'];
            echo "</div>";

            $show = substr($client['Email']['bod开发者_如何转开发y'], 0, 65);


            echo $html->tableCells(array(array($client['Email']['date'], $client['Email']['time'],
                            $client['Email']['from'], $show . "......" .
                            "<div id='popupShow'> Show more....... </div>")));}

jquery code

jQuery.noConflict();
 `jQuery(document).ready(function(){   

jQuery('#popupShow').click(function(e){ //getting height and width of the message box var height = jQuery('#popuup_div').height(); var width = jQuery('#popuup_div').width(); //calculating offset for displaying popup message leftVal=e.pageX-(width/1.5)+"px"; topVal=e.pageY-(height/13)+"px"; //show the popup message and hide with fading effect jQuery('#popuup_div').css({left:leftVal,top:topVal}).show(); });

jQuery('#image').click(function(e) { jQuery('#popuup_div').fadeOut('fast'); }); });`

how can i make it works for all the emails?


HTML id's must be unique. Try replacing your id's with classes.


I don't see a lot of CakePHP in this problem. Nor do I see a loop that would iterate over the emails.

0

精彩评论

暂无评论...
验证码 换一张
取 消