CSS-Tricks / MovingBoxes

Simple horizontal slider which grows up the current box when it's in focus (image, title & text) and back down when it's not in focus.
http://css-tricks.github.io/MovingBoxes/
GNU Lesser General Public License v3.0
280 stars 147 forks source link

how to call jquery on any other event? #32

Closed KarunaHotlani closed 13 years ago

KarunaHotlani commented 13 years ago

Hi,

This is really very nice jquery plugin. But I have one problem.

What I am doing is, I am previewing htmls in this scrollbar (instead of images). after previewing html,I want to change any of that html (change text of html or change image) which gets update in database and preview the updated html fetched from database on this scrollbar. I am updating these htmls using ajax. Now when I am previewing updated html using ajax page is not reloading where as your jquery calls only when page loads. So I want to know how can i call this jquery on any event. like onclick or etc.

Mottie commented 13 years ago

Hi KarunaHotlani!

I had to read this several times, but I think what you are asking is how do you call a jQuery function after you've updated MovingBoxes using ajax.

I'm only guessing that what you are looking for is to use the ajax callback method... the load event can be used to load content into a panel, then the callback can apply click events or whatever once the load is complete. For example:

// get new panel content
$.get('ajax/test.html', function(data){
  $('#slider').find('li:eq(0)')
    .html(data)
    .find('.popup').click(function(){
      // do something
    })
    .movingBoxes(); // make the plugin update
});
Mottie commented 13 years ago

I'm guessing this solved your problem, so I'm closing this issue.

KarunaHotlani commented 13 years ago

I never tried that solution, as such I moved out to some other design. May be later on I will again do that. At that time I will check that solution. By the way thanks your help.

Thank You Karuna Hotlani eMbience Inc.

-----Original Message----- From: Mottie [mailto:reply@reply.github.com] Sent: Monday, August 22, 2011 7:16 PM To: karuna@embience.com Subject: Re: [MovingBoxes] how to call jquery on any other event? (#32)

I'm guessing this solved your problem, so I'm closing this issue.

Reply to this email directly or view it on GitHub: https://github.com/chriscoyier/MovingBoxes/issues/32#issuecomment-1876465