jquery - How can I prevent my tab-navigation from resetting on reload? -
should out there able me or point me right direction, appreciate lot!
i created wordpress-site uncle’s rental business. i’m still amateur javascript/jquery , php. can see page of holiday apartment here:
as can see in center-top, there tab-menu showing apartments house in different categories/tabs (amount of persons).
now, visitor chooses click on f.e. 5-persons appartment, when gets new site of 5-persons apartment, tab-navigation gets resetted , shows 2 person category again. here problem: logically thinking should show 5 persons-tab, , not resetted on every reload…
is there way ask database, kind of apartment is, can show right tab?
the tab-navigation created of theme-shortcode. can tab somehow stay on same tab clicked instead of being resetted everytime?
how go this?
thanks lot in advance!
edit:
here's minified javascript:
(function(c){function p(d,b,a){var e=this,l=d.add(this),h=d.find(a.tabs),i=b.jquery?b:d.children(b),j;h.length||(h=d.children());i.length||(i=d.parent().find(b));i.length||(i=c(b));c.extend(this,{click:function(f,g){var k=h.eq(f);if(typeof f=="string"&&f.replace("#","")){k=h.filter("[href*="+f.replace("#","")+"]");f=math.max(h.index(k),0)}if(a.rotate){var n=h.length-1;if(f<0)return e.click(n,g);if(f>n)return e.click(0,g)}if(!k.length){if(j>=0)return e;f=a.initialindex;k=h.eq(f)}if(f===j)return e; g=g||c.event();g.type="onbeforeclick";l.trigger(g,[f]);if(!g.isdefaultprevented()){o[a.effect].call(e,f,function(){g.type="onclick";l.trigger(g,[f])});j=f;h.removeclass(a.current);k.addclass(a.current);return e}},getconf:function(){return a},gettabs:function(){return h},getpanes:function(){return i},getcurrentpane:function(){return i.eq(j)},getcurrenttab:function(){return h.eq(j)},getindex:function(){return j},next:function(){return e.click(j+1)},prev:function(){return e.click(j-1)},destroy:function(){h.unbind(a.event).removeclass(a.current); i.find("a[href^=#]").unbind("click.t");return e}});c.each("onbeforeclick,onclick".split(","),function(f,g){c.isfunction(a[g])&&c(e).bind(g,a[g]);e[g]=function(k){k&&c(e).bind(g,k);return e}});if(a.history&&c.fn.history){c.tools.history.init(h);a.event="history"}h.each(function(f){c(this).bind(a.event,function(g){e.click(f,g);return g.preventdefault()})});i.find("a[href^=#]").bind("click.t",function(f){e.click(c(this).attr("href"),f)});if(location.hash&&a.tabs=="a"&&d.find("[href="+location.hash+"]").length)e.click(location.hash); else if(a.initialindex===0||a.initialindex>0)e.click(a.initialindex)}c.tools=c.tools||{version:"1.2.5"};c.tools.tabs={conf:{tabs:"a",current:"current",onbeforeclick:null,onclick:null,effect:"default",initialindex:0,event:"click",rotate:false,history:false},addeffect:function(d,b){o[d]=b}};var o={"default":function(d,b){this.getpanes().hide().eq(d).show();b.call()},fade:function(d,b){var a=this.getconf(),e=a.fadeoutspeed,l=this.getpanes();e?l.fadeout(e):l.hide();l.eq(d).fadein(a.fadeinspeed,b)},slide:function(d, b){this.getpanes().slideup(200);this.getpanes().eq(d).slidedown(400,b)},ajax:function(d,b){this.getpanes().eq(0).load(this.gettabs().eq(d).attr("href"),b)}},m;c.tools.tabs.addeffect("horizontal",function(d,b){m||(m=this.getpanes().eq(0).width());this.getcurrentpane().animate({width:0},function(){c(this).hide()});this.getpanes().eq(d).animate({width:m},function(){c(this).show();b.call()})});c.fn.tabs=function(d,b){var a=this.data("tabs");if(a){a.destroy();this.removedata("tabs")}if(c.isfunction(b))b= {onbeforeclick:b};b=c.extend({},c.tools.tabs.conf,b);this.each(function(){a=new p(c(this),d,b);c(this).data("tabs",a)});return b.api?a:this}})(jquery);
set cookies. might easier using jquery: https://github.com/carhartl/jquery-cookie
Comments
Post a Comment