开发者

Need Help with Facebox jquery in Zend Framework

开发者 https://www.devze.com 2023-02-20 23:35 出处:网络
Currently I\'m working on a project using Zend framework and the message notification dialog box (using Facebox jquery).

Currently I'm working on a project using Zend framework and the message notification dialog box (using Facebox jquery).

I wanted to make my message notification dialog box to be smarter rather having the user click onto the link, before the Notification Message box appear. I wanted to make it if there's inbox messages then the message box appear else it doesn't appear on the screen.

I have 2 questions,

  1. How can I make the message notfication dialog box popup when the page load . (without requiring the user click onto the link)
  2. Second question how can I control the dialog box to display or not to display in Zend framework Controller?

Thanks so much in advance!

Here is my current code

When a user click onto the link, the Notification Message box appear on the screen

<a href="#messages" rel="modal">Notification Messages</a>

Here the javascript code to Initialise the Facebox Modal window:

$('a[rel*=modal]').facebox(); // Applies modal window to any link with 开发者_StackOverflowattribute rel="modal"


How can I make the message notfication dialog box popup when the page load . (without requiring the user click onto the link)

There are several way to do this, depending on your use case. If you want to notify users in "real time" you may use javascript setTimeout() or setInterval() functions to start a timer and trigger an ajax request to check for new message.

If you just want to do that on page load, well, a simple flag like var hasMessages = true; would do the trick.

In both case, consider writing a View Helper (see my second answer below)

Second question how can I control the dialog box to display or not to display in Zend framework Controller?

Controllers are not intended to "display" or "not display".
What you are probably looking for is View Helper


$(document).ready(function(){
    $("a[rel=modal]").trigger("click");
});


$(document).ready(function(){
    $(#dialog).dialog{
    autoOpen:true;  //#Dialog is div id of dialog box
}
0

精彩评论

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