SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2011
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Open All Links Within Div in New Window

    I've created a website with Joomla - newwebbsite.prosperaplace.com and I am using a module to display the upcoming events. The parameters of the module allow me to set if links target blank window, which i have it set to. This only applies to the title though, and when you click on the image it will open in the same window. How can I make it so that the link will open in a new window when the image is clicked? I've tried every tip I could find, trying to implement code that will open all links withing that div (box_clone or container_skitter) but had no such luck. Any suggestions?

  2. #2
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    This is better suited for javascript, not PHP.

    If you use jQuery, you can do something like

    Code:
    $('.container_skitter a').click(function(e) {
        e.preventDefault();
        window.open($(this).attr('href'));
    });

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2011
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. I tried putting this in the index.php file in the body element with no luck. Where would the correct place be to put this?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •