Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $$('a.popup').each(function(el){
- el.addEvent('click', function(e){
- var href = el.href.toString();
- href += href.contains("?") ? '&ajax' : '?ajax';
- if ($('popup')){
- $('popup').destroy();
- }
- var popup = new Element('div', {'id': 'popup'});
- var popupInner = new Element('div', {'id': 'popupInner'}).inject(popup);
- var closeBtn = new Element('a', {'id': 'closeBtn', 'style': 'cursor: pointer'}).inject(popup, 'top');
- var myFx = new Fx.Morph(popup, {'duration': 600});
- if (el.rel){
- rel = el.rel.toString();
- xPos = rel.split(",")[0];
- yPos = rel.split(",")[1];
- myFx.set({'left': xPos, 'top': yPos});
- }
- myFx.set({'opacity': 0});
- closeBtn.addEvent('click', function(e){
- myFx.start({'opacity': 0});
- var e = new Event(e).stop();
- });
- popup.inject(el.getParent());
- // Fetch popup content
- var req = new Request.HTML({
- method: 'get',
- url: href,
- data: {},
- update: $('popupInner'),
- onComplete: function(response) {
- myFx.start({'opacity': 1});
- }
- }).send();
- var e = new Event(e).stop();
- });
- });
- $content = array();
- $content['popup_content'] = $this->load->view('popupVehicle',array(), TRUE);
- $this->load->view(*your view*, $content);
- <script type='text/javascript'>
- /*Place your popup-showing logic here
- you need to show $('#popup') element*/
- </script>
- <div id='popup'><? echo $popup_content?></div>
Add Comment
Please, Sign In to add comment