0

I use FancyBox 2, and I want to edit inline style and I want to remove display: block; from fancybox-overlay.

original:

<div class="fancybox-overlay fancybox-overlay-fixed" style="width: auto; height: auto; display: block;">

edited:

<div class="fancybox-overlay fancybox-overlay-fixed" style="width: auto; height: auto;">
user2151960
  • 185
  • 1
  • 1
  • 17
  • possible duplicate of [How can I erase all inline styles with javascript and leave only the styles specified in the css style sheet?](http://stackoverflow.com/questions/1229688/how-can-i-erase-all-inline-styles-with-javascript-and-leave-only-the-styles-spec) – Michael Doye Apr 14 '15 at 21:38
  • If your remove `display: block;` property from `fancybox-overlay fancybox-overlay-fixed`, the entire fancybox will disappear. What is exactly the purpose of this? or what do you want to achieve? – JFK Apr 21 '15 at 21:27

2 Answers2

1

Try

$('.fancybox-overlay.fancybox-overlay-fixed').css('display', '')
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="fancybox-overlay fancybox-overlay-fixed" style="width: auto; height: auto; display:block;">No display Block</div>
Tiago
  • 358
  • 2
  • 14
0

If you want inline you must do it always when it will be shown... The better way is remove it in CSS

.fancybox-overlay.fancybox-overlay-fixed { display: inline!important; }

But if you need inline version you can always take action to the event beforeShow:

$('.fancybox').fancybox({
   beforeShow: function() {
     $('.fancybox-overlay.fancybox-overlay-fixed').css('display', '')
   }
});