I apologize up front for this off-topic question, but I thought I'd try here first. I have Views Rotator working great. I'm trying to get it working with a jquery drop shadow plugin. I have the two working together, but since I'm using jquery's $(document).ready to apply the drop shadow, the shadow only appears for the first piece of rotated content. My question is, how can I apply the shadow for each piece of content as it rotates in?
The first shadow stays applied when the content rotates back in, so I think I only need to apply the shadow the first time each piece of content is displayed (maybe based on a timer?). Of course, I'd settle for applying the shadow each time the content loads.
For what it's worth, here's the code I'm currently using to call the dropshadow.js script:
drupal_add_js(path_to_theme() . '/jquery.dropshadow.js');
drupal_add_js(
'$(document).ready(function(){
$(".view-data-image-attach-iid").dropShadow("opacity: 1");
});',
'inline'
);
I realize that my question is completely out of left field, so feel free to tell me to go take a hike.
In any case, thanks for the great module (and the great podcast and videocast too)!
Comments
Comment #1
mfer commentedI took a brief look at the code for the drop shadow plugin. It looks like it doesn't do drop shadows on hidden elements which the items that aren't displayed in the rotation are. There would need to be a way to add a drop shadow when the element first shows. Though, there may be a flash when the drop shadow is added.
The D5 version of the Views Rotator module doesn't fire any callbacks when an item is shown. This is what you would need from it. There are two path forwards I would suggest. One is to write a patch to the D5 Views Rotator JS that fires a callback when an item is shown. The other is to craft up some custom JS that does the same thing.
Comment #2
matt v. commentedThanks a lot for getting back to me. What I've done for the time being is to set multiple delays between rerunning the drop shadow plugin. I hope to come back to this, once I get up to speed a bit more with Javascript/jQuery.