Tagged: background, lightbox, opacity, overlay, popup, pretty photo
Background opacity, lightbox
-
CreatorTopic
-
May 5, 2013 at 11:16 am #8089
mike-se
ParticipantI have been trying to change the opacity of the lightbox popup dark overlay background.
In framework/frontend/assets/plugins/prettyphoto/js/jquery.prettyPhoto.js when I try to change any of these settings nothing changes:
$.fn.prettyPhoto = function(pp_settings) {
pp_settings = jQuery.extend({
opacity: 0.95, /* Value between 0 and 1 */$pp_overlay
.css({
'opacity':0.95,
'height':$(document).height(),
'width':$(window).width()
})Any help appreciated.
-
CreatorTopic
-
AuthorReplies
-
May 5, 2013 at 7:56 pm #8092
Jason Bobich
KeymasterJust in general, it’s not a good idea to be editing jQuery plugins directly like this. In this case, you’re actually not editing a file that the theme uses (it’s just an un-minified reference of the original plugin file).
But beyond that, what you’re trying to change are properties that the plugin is purposely giving you control over from your call to the namespace. If you wanted to change what the theme sets up when binding prettyPhoto, you’d just re-bind it with your own properties from your javascript file.
If you’re using one of the starter child themes that came with Jump Start, you’ve already got a file /assets/js/theme.js setup for you that (a) proceeds the framework’s javascript and (b) establishes jQuery in a non-conflicting way.
So, specifically for prettyPhoto, all you need to do is copy the code from the framework’s javascript to your Child theme’s javascript file to re-bind to the proper selector:
$('a[rel^="themeblvd_lightbox"], a[rel^="featured_themeblvd_lightbox"]').prettyPhoto({ theme: themeblvd.prettyphoto_theme, // Filter with themeblvd_js_locals social_tools: false, // Share icons are not compatible with IE9 deeplinking: false, overlay_gallery: false, show_title: false });
Note: This would go where you see the sample theme.js file says “Put any theme-specific JS here…”
And now you’ve got the call to the prettyPhoto namespace in your hands and you can manipulate any properties you want. (See prettyPhoto documentation)
So, for example you could add in opacity like this:
$('a[rel^="themeblvd_lightbox"], a[rel^="featured_themeblvd_lightbox"]').prettyPhoto({ theme: themeblvd.prettyphoto_theme, // Filter with themeblvd_js_locals social_tools: false, // Share icons are not compatible with IE9 deeplinking: false, overlay_gallery: false, show_title: false, opacity: 0.95 });
Does that make sense?
May 6, 2013 at 3:36 am #8100mike-se
ParticipantHi Jason!
Yes, that makes total sense, and this was all new stuff to me, thanks!
It still doesnt seem to change the background opacity on the site though.May 6, 2013 at 5:16 am #8101Jason Bobich
KeymasterWhat site are you doing this at? Is this one? http://www.studiojemi.com/bonuspappan/
If so, you don’t have anything in your theme.js? Maybe a caching thing?
http://www.studiojemi.com/wp-content/themes/studiojemi/assets/js/theme.js
May 6, 2013 at 5:23 am #8103mike-se
ParticipantNope, It’s http://ralfturander.com/wp-content/themes/ralfturander/assets/js/theme.js and It’s not the cache.
I set the opacity to 1 just to see if anything happens and it doesnt.Thanks
May 6, 2013 at 6:05 pm #8113Jason Bobich
KeymasterI think it has something to do with how you’re copy/pasting this code. It looks like you’ve put rich-text quotation marks into the the javascript, opposed to actual quotation marks —
"
May 7, 2013 at 6:50 pm #8136mike-se
ParticipantThanks! Your absolutely correct. My bad 😉
-
AuthorReplies
- You must be logged in to reply to this topic.