SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2010
    Location
    ONS
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can someone give me idea of doing this in JS ?

    Can someone give me idea of doing this in JS?

    I have HTML, and I want to parse the images to show the lightbox/jquery Pop-Up Effect, without pre-adding any rel="lightbox" or something like that.

    But want to show the effect, how can I do this using JavaScript or somethign else like PHP?

    Thanks.

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Javascript is the only way to make modal/popup windows as PHP is just a raw code engine and doesn't have any power over real time DOM updates. What your wanting to attempt im pretty sure can't be done without appending an event to every element that needs to activate a popup but another method would be to use an anchor argument within the href attribute such as...

    HTML Code:
    <a href="http://www.somelink.com;lightbox">Some Link</a>
    then using a JS loop find all the elements that have that specific inline argument but that's a lot of extra work to do just for something you can easily do using rel="lytebox".

  3. #3
    SitePoint Zealot
    Join Date
    Nov 2010
    Location
    ONS
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Sir.
    I found a wordpress plugin (Lightbox Plus) is doing it, that it gets HTML and parses it to convert images into Popable.

    But I don't know how to do it on my own PHP code, because my code is not wordress based.. It is self-written..

  4. #4
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Lightbox Plus still uses the rel attribute so there's nothing different compared to using it and colorbox alone.


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
  •