I'm generating a bootstrap modal using the following plugin which loads a form into a modal dynamically.
https://nakupanda.github.io/bootstrap3-dialog/
BootstrapDialog.show({
message: $('<div></div>').load('remote.html')
});
This page then loads another modal which is google reCaptcha control. This control has a button which becomes unresponsive.
I've figured that I need to override a function that natively comes in bootstrap as mentioned in this link Problems with new Google reCAPTCHA in IE when inside modal or dialog
This single line of code should do the overriding.
$.fn.modal.Constructor.prototype.enforceFocus = function () { };
It shouldn't be that difficult but I have spent almost 2 hours trying to figure out why my function isn't overriding the original BS function?
Also, if I put the above line of code in bootstrap.js file, then the override works. Anywhere else, it doesn't.
The code works in Firefox and Chrome, but fails in IE which is out of context but the fix is for IE.
Any help is much appreciated.
Related
Problem (see title)
Yii2: Replace default confirmation message used by Gridview with Sweet alert
describes the initial problem and the fix that used to work. Now the fix no longer works. Something has changed in either bootstrap or kartik yii2-dialog that makes the work around for sweetalert in yii2 no longer a working workaround. :-)
The js/yii_overrides.js is loaded in, but the function are not used by yii’s event handler.
The javascript functions for ‘confirm’ that is used by the yii event handler points to yii2-dialog (kartik).
This can be found by running console.log(window.yii); when the document is ready.
Question: How does one disable kartik-v/yii2-dialog?
(the packages is required in composer by yii2-detail-view, yii2-grid and yii2-tree-manager (all kartik versions) as revealed by composer why kartik-v/yii2-dialog)
Perhaps disabling yii2-dialog is not the best solution to the problem, input is more than welcome. :-)
System:
Yii2-advanced app
PHP Version 7.2.11
Yii Version 2.0.17-dev
sweetalert Version 1.1.3
kartik-v/yii2-dialog Version 1.05
Tried:
Yii2: Replace default confirmation message used by Gridview with Sweet alert
When yii\bootstrap\BootstrapPluginAsset’ => [‘js’=>[]], is added to bundles in assetManager in components in (common\config\main.php)
The result is the desired sweetalert alert message, but then bootstrap modal and other things from bootstrap stop working.
If that line is not added then only the bootstrap alert message box comes up, and not the sweetalert message box.
(the line used above was taken from the following stackoverflow:
Yii2 disable Bootstrap Js, JQuery and CSS
)
Thank you for your time. Any help or pointers would be greatly appreciated.
in frontend bootstrap.php:
\Yii::$container->set('kartik\dialog\Dialog', ['overrideYiiConfirm' => false]);
it is a global override.
Hello guys,
I have a strange problem with my ASP.NET 4.5 page. For some strange reason, my window.onbeforeunload function gets overwritten every time I load the page. Inside the debugger, I can clearly see that the right value is set in my head section, if I place a breakpoint there. However, after finishing the loading process of the site, the value changes to the following:
function (a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b}
I have no idea where this is coming from. This is my code from the head section of the page:
window.onbeforeunload = function (e) { return 'Do you really want to cancel?'; };
I'm using JQuery 2.1.3 as well as DevExpress 14.2 in my project. Any idea what could be responsible for this weird behavior?
Thanks in advance!
I actually found the answer where this is coming from thanks to #DavidTansey's hint. It's the Browser Link feature that was introduced in Visual Studio 2013. It looks like Browser Link uses some old jQuery library and overwrites various handlers.
So if you are having the same issue, please try to disable the feature (the menu is next to the browser selection in the tool bar). This should solve the problem.
I'm pretty sure that this problem wouldn't appear on a real server, because it would likely not use Browser Link.
I have a problem with the bootstrap modal function.
I try to open a modal when clicking on a button. In Bootply everything works fine, but in my document it's not working and I can't see why.
I try to use the modal in the portfolio section of this page
Here is my code snippet on bootply which is perfectly working...
Any Ideas???
If you take a look in for example Chrome's DevTools console you'll notice an error message like:
Uncaught Error: Bootstrap's JavaScript requires jQuery version 1.9.1
or higher
this either means that jQuery isn't loaded or that Bootstrap's JavaScript is loaded before jQuery.
If you take a look in your head section you'll see that the latter is the case. Make sure that js/jquery-1.11.1.min.js occurs before js/bootstrap.min.js.
P.S. it might be that the modal still doesn't work after these changes, but you need to fix this first.
I'm trying to use a script on my website who pop a navbar. There is a declaration on this script :
(function($){
$.cookieBar = function(options,val){
....
};
some other stuff here
})(jQuery);
We can see this script here it's working without any problem on all of my website called with :
$(document).ready(function(){
$.cookieBar();
});
In just one webpage there is a bug (css and js are include) :
TypeError: $.cookieBar is not a function
$.cookieBar();
I don't understand why. If anyone have any idea. On this webpage there is one major script who is working normaly without this cookie-nav-script but because of this bug nothing work at all.
I don't use any experimental stuff from this script and I attached this cookies-bar at the body.
I am using the Twitter Bootstrat Freelance theme (http://startbootstrap.com/templates/freelancer/) and have incorporated Own Carousel.js (http://www.owlcarousel.owlgraphic.com/demos/demos.html).
All is working well apart from whenever I click an image to view it in a modal window, it appears the wrong size - until I resize my browser window, or refresh the page, or eg press f12. It then seems to 'fix itself'.
Not sure if this is a js conflict issue or I am doing something silly (I am quite new to js). I have looked at the console and can't see any errors, I have also tried different versions of jquery and bootstrap however no difference.
I have created a jsfiddle here http://jsfiddle.net/johnny_s/34L6t/2/
If you view the jsfiddle, try click an image and once it opens in the modal window, resize the screen slightly and you will see what I mean. It somehow suddenly fixes itself.
I would appreciate any help or direction on this issue, as I am trying to create a personal project which needs to be finished quite soon :s
Need to include the following external js files.
Thanks to #Sebsemillia for the help
owl.autorefresh.js
owl.autoplay.js