Dom Css在jQuery Pagination Wordpress小部件后丟失了

[英]Dom Css lost after jQuery Pagination Wordpress widget


I have developed a widget for Wordpress to show portfolio, the user can choose if he wants pagination, filter categories, the number of post per page...and so on, it works all perfectly with a php pagination system i have made.

我已經開發了一個用於Wordpress的小部件來顯示組合,用戶可以選擇是否要分頁,過濾類別,每頁發布的數量......等等,它完全適用於我制作的php分頁系統。

I am trying to implement an ajax jquery to this pagination in widget to make it reload without reloading the whole page. I have this code:

我試圖在小部件中為這個分頁實現一個ajax jquery,使其重新加載而不重新加載整個頁面。我有這個代碼:

jQuery('.paginate a').live('click', function(e){ 
e.preventDefault(); 

var link = jQuery(this).attr('href');  
jQuery('.widget_gantry_portfolio').html('<div class="loading"></div>');
jQuery('.widget_gantry_portfolio').load(link+' .widget_gantry_portfolio .portfolio_class');

The pagination works perfectly in php, when I implement this code the pagination works but when clicked the widget losses all the user preferences(show filter, show pagination..etc), the divs also loose their calculated % width and height that was firstly present in css(seen in firebug):

分頁在php中完美運行,當我實現此代碼時分頁有效,但是當單擊小部件時會丟失所有用戶首選項(show filter,show pagination..etc),div也會松開他們計算出的首先出現的%寬度和高度在css(在firebug中看到):

element.style{width and height}

I have been several days around this and have prove instead of live, on and delegate, and so on, but none of them work, this ajax pagination is working also perfectly in posts pagination on my site but the widget does´nt reload Dom elements?

我已經有好幾天了,已經證明了,而不是現場,on和委托,等等,但沒有一個工作,這個ajax分頁在我的網站上的帖子分頁也完美地工作但是小部件沒有重新加載Dom元素?

The most important thing for me are:

對我來說最重要的是:

-Each of the elements missing width and height, that was in DOM css, firstly this width is calculated with a functions.php enqued script that goes like this for example when it has 4 columns:

- 缺少寬度和高度的每個元素,在DOM css中,首先使用functions.php enqued腳本計算此寬度,例如當它有4列時:

var mysizes = function() {
    theWidth4 = jQuery(".mosaic-block4c img").css('width');
    jQuery(".mosaic-block4c").css('width', theWidth4);
    theHeight4 = jQuery(".mosaic-block4c img").css('height');
    jQuery(".mosaic-block4c").css('height', theHeight4);
}

I call the mysizes(); function from the widget php with a tag

我叫mysizes();功能從小部件PHP與標簽

-The filter of categories missing i think because, when pagination load, doesn't recognizes the user presets for widget.It recognizes it perfectly in first page but no in subsequent pages.

- 缺少類別的過濾器我認為,因為,當分頁加載時,不識別用戶的小部件預設。它在第一頁中完全識別它,但在后續頁面中沒有。

Link to the site with portfolio widget pagination not working properly (please click 2 page to see):

鏈接到該網站,投資組合小部件分頁無法正常工作(請點擊2頁查看):

http://framecero.com/aagantrywordpress/?page_id=635

http://framecero.com/aagantrywordpress/?page_id=635

Link to a sample category with this same pagination working (pagination at the bottom of page):

使用相同的分頁工作鏈接到樣本類別(頁面底部的分頁):

http://framecero.com/aagantrywordpress/?cat=4

http://framecero.com/aagantrywordpress/?cat=4

1 个解决方案

#1


1  

From Jure C. comment:

來自Jure C.評論:

A quick look shows that you're at least changing HTML structure. On paginated page you have .portfolio_class twice nested while original is only once.

快速瀏覽表明您至少改變了HTML結構。在分頁頁面上,您將.portfolio_class兩次嵌套,而原始只有一次。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2012/06/14/eff7e1b80e7eed2fefe3eb6955fe12b8.html



 
  © 2014-2022 ITdaan.com