English 中文(简体)
j Query Unwanted reging of DOM on history.back(-1)
原标题:jQuery Unwanted resetting of the DOM on history.back(-1)

如下文稿在本网站上使用:

如用户查询,例如[jan],可在以下地图上登出。 当用户点击胎面时,在地图上出现一个显示与一个分页链接的插图。 所有这一切都是按预期进行的。

Problem 1: The problem is when the user returns to the frontpage via a (history-1) link. The checkboxes are then all cleared, the dots and teaser text is set back to base. Except in Firefox – it works perfectly in Firefox. I guess the problem has something to do with the DOM being reset in all other browsers than Firefox? (I want the checkbox selection, dots on the map, and the chosen teaser text to still visible when the user returns to the page with the map).

  How can I avoid this problem? With some kind of .live function? (deprecated from jQuery 1.7)

Problem 2: When a user checks [all] all checkboxes are checked as intended. But to make sense the checkbox [All]’s selection should disappear when one of the other checkboxes is unchecked. (The remaining checked boxes should stay checked)

<><>>> 如何做到这一点?

/**functions.js**/ 

$(document).ready(function () {

/* =Filtering - (mark the map with dots)
----------------------------------------------- */
    $(function () {

        $( #filtering :checkbox.checkall ).click(function () {
            $(this).parents( fieldset:eq(0) ).find( :checkbox ).attr( checked , this.checked);
        });


            $("#filtering :checkbox").attr( checked , null); //uncheck checkboxes on page reload in Firefox
            $("#filtering :checkbox").click(function() {
                $("#pageTeaser article mark").hide();
                $("#filtering :checkbox:checked").each(function() {
                    $("." + $(this).val()).show();
                });
            });

    });



/* =Teaser Show - (Showing teaser text when clicking the dot s)
----------------------------------------------- */
    $( #pageTeaser article mark ).click(function() {
        $( #pageTeaser article .inner ).hide();
        $( #pageTeaser article .inner ).removeClass( active );
        $(this).siblings( .inner ).show();
        $(this).siblings( .inner ).addClass( active );
    });

});
问题回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签