Welcome Guest, Not a member yet? Register   Sign In
Using lightbox with forms and ajax content
#1

[eluser]landitus[/eluser]
Hi all! I'm developing a website which uses Lightbox or modal windows heavily. In most cases there's a photo gallery inside, but there's a form in one of them. How should I override CI links to load ajax content inside the Lightbox? and how to override the form submit to make it work? I guess I should develop the whole site without js and using the controllers, that seams easy. The trick is how to add the js layer to point controllers (or load partial views).

I hope you guys get what I'm trying to accomplish. The site is similar to this: http://matthewanderson.cc/ but instead of loading each work above the page, it should open a lightbox modal window with the content.
#2

[eluser]Zeeshan Rasool[/eluser]
If i got your question then, if you are getting images on run time using ajax call then for a form pass a param to aja call which would go to controller function, In that function you can put a check to identify that it is a form.
#3

[eluser]landitus[/eluser]
Hey Zeeshan! Thanks for the reply. Could you be more specific? I quite not get what you mean by the check to identify part. Is there an example you can provide? Thanks!
#4

[eluser]treeface[/eluser]
What you need to do is attach submit (click) event listeners to your forms (links), run your code to bring up the lightbox in there, and return false at the end of the function. Returning false kills the normal execution of your forms or links so that it follows through for people without javascript and performs the javascript action for people with it. This is a method that is sometimes referred to as hijax.




Theme © iAndrew 2016 - Forum software by © MyBB