Jump to content

Target the last image and apply a class to it


tinacious
 Share

Recommended Posts

Hi everyone,

I would like to target the last image in the fieldset and apply a specific class to it. How would I do that?

I've tried this and it applies it to all:

if(($page->images->last()->name) == 'whatsnext.png') { echo $whatsnextclass; }

It's not targeting that specific image, it's just checking to see if that exists. I don't know how else to go about this. Help please?

Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...