相关疑难解决方法(0)

你可以使用哈希导航而不影响历史吗?

恐怕这可能是不可能的,但有没有办法改变一个URL的哈希值不留在浏览器的历史记录中的条目没有重装?或者做同等的?

至于具体细节,我正在开发一些基本的哈希导航:

//hash nav -- works with js-tabs
var getHash = window.location.hash;
var hashPref = "tab-";
function useHash(newHash) {
    //set js-tab according to hash
    newHash = newHash.replace('#'+hashPref, '');
    $("#tabs li a[href='"+ newHash +"']").click();
}
function setHash(newHash) {
    //set hash according to js-tab
    window.location.hash = hashPref + newHash;

    //THIS IS WHERE I would like to REPLACE the location.hash
    //without a history entry

}
    // ... a lot of irrelavent tabs js and then....

    //make tabs …
Run Code Online (Sandbox Code Playgroud)

javascript jquery browser-history fragment-identifier browser-state

96
推荐指数
3
解决办法
4万
查看次数

如何创建简单的jQuery插件?

这个测试插件应该像这样工作:当点击一个元素时,它会向下移动.就那么简单.

jQuery.fn.moveDown = function(howMuch){
    $(this).css("border", "1px solid black");
    $(this).click(function(){

        $(this).css("position", "relative");
        $(this).animate({top: '+='+howMuch});
    }); 
}
Run Code Online (Sandbox Code Playgroud)

问题是,当单击一个元素时,它不仅会移动被点击的元素,还会移动插件所应用的所有其他元素.

这是什么解决方案?

javascript jquery plugins jquery-plugins extend

2
推荐指数
1
解决办法
634
查看次数