0

I am new in Drupal 7. What i am trying to do is to show pop up information windows for the following case:

I have a view with links (internal links to drupal site). I want by clicking on them:

1.To show an information pop-up window with the message "Redirection to the official position..."

  1. This message to be showing for 3 seconds and

  2. The message to disappear after 3 seconds and the redirection to be completed.

How can i show specific pop-up windows by clicking a link and before the redirection takes place?

1 Answer 1

0

I am not aware of a contrib module to achieve this, but you can always use jQuery in your theme or custom module.

Something like this might work (not tested, but that's the main idea - out of scope for Drupal Answers):

jQuery(document).ready(function() {
  // on link click (jQuery 1.4)
  jQuery('#my-link').click(function(e) {
    // preventDefault otherwise browser will go to link
    e.preventDefault();
    // show the pop-up layer which is assumed hidden with css or sth.
    jQuery('#my-popup-layer').fadeIn();
    // here you can possibly chain up more actions in order to 
    // update the contents of the pop-up
    // now delay 3sec
    jQuery(this)
      .delay(3000)
      .queue(function(next) {
        // redirect
        window.location.href = jQuery(this).attr('href');
        next(); // prob redundant
      });
  });
});
4
  • i can't solve my problem with this way, because i have a lot of links and i can't substitute each link in '#my-link' to jQuery click form. Except of this, these links are added from users dynamically, Commented Nov 27, 2014 at 11:44
  • You have a Views view, don't you? A view which outputs all relevant links? You do not need to reference each link individually, this is just an example. You can use a jQuery selector to the field's link, eg. jQuery('.view-my-view .views-row .views-field-my-link a').
    – Wtower
    Commented Nov 27, 2014 at 11:58
  • I want to combine the Rules and Messages modules to do this, because i am not good in jQuery and probably i will have problems Commented Nov 27, 2014 at 13:22
  • Your requirement cannot be fulfilled server-side and you would need at least a module that can provide the js logic. Neither modules seem to me to be able to help.
    – Wtower
    Commented Nov 27, 2014 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.