Archived
Fixed collision between multipage and modal link event
This commit is contained in:
1 parent
f508131a50
commit
c579653877
2 files changed
+13
-6
No files matched your search
+2
-4
@@ -64,6 +64,7 @@ foreach($items as $item)
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
$j(function()
|
||||
{
|
||||
var $ = $j;
|
||||
@@ -76,10 +77,7 @@ $j(function()
|
||||
|
||||
items = $j(id);
|
||||
|
||||
var from = $j("body").scrollTop();
|
||||
if(!from) from = $j("html").scrollTop();
|
||||
window.location = this.href;
|
||||
$j("body,html").scrollTop(from);
|
||||
setLocationWithoutScrolling(this.href);
|
||||
|
||||
var targetOffset = items.offset().top - 30;
|
||||
$j("html,body").animate({scrollTop:targetOffset}, 500);
|
||||
|
||||
+11
-2
@@ -66,7 +66,7 @@ function showUrlModal(href)
|
||||
});
|
||||
},
|
||||
onClose: function (dialog) {
|
||||
window.location = preModal;
|
||||
setLocationWithoutScrolling(preModal);
|
||||
dialog.data.slideUp('fast', function () {
|
||||
dialog.overlay.slideUp('fast', function () {
|
||||
dialog.container.fadeOut('fast', function () {
|
||||
@@ -82,6 +82,14 @@ function showUrlModal(href)
|
||||
|
||||
}
|
||||
|
||||
function setLocationWithoutScrolling(location)
|
||||
{
|
||||
var from = $j("body").scrollTop();
|
||||
if(!from) from = $j("html").scrollTop();
|
||||
window.location = location;
|
||||
$j("body,html").scrollTop(from);
|
||||
}
|
||||
|
||||
var preModal = window.location.href + "#"
|
||||
if(preModal.indexOf("#") == -1) preModal = preModal.substr(0, preModal.indexOf("#"));
|
||||
|
||||
@@ -99,8 +107,9 @@ $j(function()
|
||||
|
||||
var modal_not_match = Array(/wp-admin/);
|
||||
|
||||
$j("[href]").click(function(e)
|
||||
$j(".content .post [href],#header [href]").live('click',function(e)
|
||||
{
|
||||
preModal = window.location.href;
|
||||
for(var i = 0; i < modal_match.length; i++)
|
||||
if(this.href.match(modal_match[i]))
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user