Comments (9)
I even removed the href attribute and it still scrolls page to the top.
from alertifyjs.
As far as i can see, even plain alertify.alert("test"); scrolls page to the top after clicking OK.
from alertifyjs.
That's because you are using # as your href, use <a href="javascript:void(0);" ...></a>
instead.
from alertifyjs.
Hi,
I already tried that. Actually, it's not about the HREF. It even scrolls just after any alertify call. Haven't found what it causes yet. It intersects somehow with another jQuery code but i can't see where. Still looking into it.
Do you have any tips how to debug JS code? I set a breakpoint, but it didn't help, just passed it and that's all.
Thank you.
from alertifyjs.
I just commented ALL my code and leave only:
$(document).ready(function() {
$('.ratesbtn2').on('click', function(e){
e.stopPropagation();
alertify.alert("123");
e.preventDefault();
return false;
});
}
and it's still reproducible.
from alertifyjs.
Just found. Setting CSS like:
body, html {
width: 100%;
height: 100%;
}
makes Alertify behave like i described. Do not know why. Is it a my mistake?
Thank you.
from alertifyjs.
I was able to reproduce this using Safari on windows, Seems related to setting focus to the dialog while body overflow is removed.
Setting tabindex="0"
on your link will make the dialog return focus to the element when the dialog is closed.
Also you can use a custom alert that sets no focus to any of the dialog elements:
alertify.dialog('customAlert', function () {
return {
setup: function () {
return {
buttons: [
{
text: alertify.defaults.glossary.ok,
key: 27/*ESC*/,
className: alertify.defaults.theme.ok,
}
],
focus: {
element: function(){
/*Returning false will focus nothing, but it will make
contents behind the modal accessible via Tab key.
*/
return false;
},
select: false
},
options: {
maximizable: false,
resizable: false
}
};
},
}
}, false, 'alert');
I need to investigate this more...
from alertifyjs.
Include this in your document.ready function to maintain scroll position:
var lastX,lastY;
alertify.alert().set({
'onshow':function(){
lastX = window.scrollX;
lastY = window.scrollY;
},
'onfocus':function(){
window.scrollTo(lastX, lastY);
}
});
I'll add this to the core script on next update.
Thanks.
from alertifyjs.
Hi,
Thank you for your help!
from alertifyjs.
Related Issues (20)
- Multiple alert boxes go away at once HOT 1
- Close all alertify messages
- Sequential Prompts HOT 1
- Auto-Dismiss Alerts HOT 1
- Why is impossible change anything from default options??? HOT 1
- Instance vs global properties HOT 1
- alertify.notify stopped showing in safari macos HOT 3
- onshow only firing on second alertify.confirm() call HOT 2
- License using LGPL HOT 1
- ESC/ENTER/TAB Press always invoke oncancel call HOT 1
- 'alertifyjs'. CommonJS or AMD dependencies HOT 3
- Correction on Guide HOT 1
- Commercial license purchase not working? HOT 4
- Cannot read properties of undefined (reading 'preinit') HOT 3
- Brave blocks Alertify HOT 6
- setContent `textarea` get its value HOT 2
- Notify & modal HOT 2
- adding number input to confirm dialog HOT 1
- After Show Event
- Support wrapped instances of String HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alertifyjs.