How to add an icon over preview image?

136 views
Skip to first unread message

bluepills

unread,
Jun 5, 2012, 4:34:45 PM6/5/12
to fancybox
I would like to add a small "+" over my thumbnails but don't know how
to achieve this..
I'm asking because otherwise I have to add an image over my image in
photoshop and that takes time!! I would like to be able to have a
class or something that would add it every time easily..

Mar Ventus

unread,
Jun 6, 2012, 7:13:56 AM6/6/12
to fanc...@googlegroups.com
Hi bluepills!
You should use the beforeShow callback parameter for that.
jQuery(' {targeted-element}' ).fancybox({
   'beforeShow': function() {
      jQuery(".fancybox-inner").append('<div class="plus-sign" />');
   },
});
That code will add a div with the class "plus-sign" right after your images. Once you do that, it would only be a matter of styling that div through CSS code.
Cheers!




--
You received this message because you are subscribed to the Google Groups "fancybox" group.
To post to this group, send email to fanc...@googlegroups.com.
To unsubscribe from this group, send email to fancybox+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fancybox?hl=en.


Mar Ventus

unread,
Jun 6, 2012, 7:15:19 AM6/6/12
to fanc...@googlegroups.com
I forgot to mention that you are supposed to replace {targeted-element} with the element you are targeting.

JFK

unread,
Jun 7, 2012, 9:10:26 PM6/7/12
to fancybox
@Mar Ventus
He doesn't want to add anything over the image opened in fancybox but
in the thumbnail that actually you have to click to open fancybox.

@bluepills
That is not a fancybox issue (that we provide support here). Check in
CSS forums like http://groups.google.com/group/css-design
try "adding/positioning elements over other elements"

On Jun 6, 4:15 am, Mar Ventus <marventus...@gmail.com> wrote:
> I forgot to mention that you are supposed to replace
> *{targeted-element}*with the element you are targeting.
>
>
>
>
>
>
>
> On Wed, Jun 6, 2012 at 8:13 AM, Mar Ventus <marventus...@gmail.com> wrote:
> > Hi bluepills!
> > You should use the beforeShow callback parameter for that.
> > jQuery(' {targeted-element}' ).fancybox({
> >    'beforeShow': function() {
> >       jQuery(".fancybox-inner").append('<div class="plus-sign" />');
> >    },
> > });
> > That code will add a div with the class "plus-sign" right after your
> > images. Once you do that, it would only be a matter of styling that div
> > through CSS code.
> > Cheers!
>
Reply all
Reply to author
Forward
0 new messages