I have created a menu with HTML, which uses simple ul with lots of LIs. Each item contains a link with the class "primary" when a list item (anywhere in the list item - not just text) is clicked, jquery checks to see that the items in the class "primary" There is a link with it, and if so, it loads a specific page in a hidden device (which I see temporarily, though it is not really temporary ...) and then some parts of the new page are visible W For the parts of the page can be set as the html is out for. For example, ".temp .content" and move locations to ". Content" This basically removes html, sets nothing to "html of .temp" (otherwise the line $ (". Content "). Html (newhtml); will set html of" .content "in the temporary div) and then sets html to the original content html.
I have a little problem, though. It seems that this sometimes makes the devils empty, sometimes it takes two clicks to load the page and sometimes I can click on item 1, then click on item 2 and it Instantly loads content from item 1 (i.e., which is displayed in the content of the page which is loaded by item 1).
Actually I can make "chain" - items 1, 2, 3, 4 and then again 1 and 2 by clicking again and I am blank, content items 1, 2, 3, 4 and 1 for.
Does anyone have a clue about what is happening here?
Many thanks in advance.
Regards,
Richard
In response to Peter Ajaitai (I have tried to minimize it as much as possible - it is actually very complex Because I have a 3 color layout and a fix to shade all the 3 columns at the same height - but I think all the necessary stuff is here ...)
The basic structure of the page: < / P>
& lt ;; DOCTYPE HTML PUBLIC "- // W3C // DTT XHTML 1.0 Transcription // N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" & gt; & Lt; Top & gt; // jquery $ ("li") click (function () {var url = $ (this) .find ("a.primary"). Attr ("href"); if (url! = "" & Amp; & Amp; amp; url! = Null) {$ (". Temp"). Load (url); var newhtml = $ (". Temp .content") .HTML (); $ (". Temp") .html (" "); $ (". Main-col "). Html (newhtml);}}); & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div class = "wrapper" & gt; & Lt; Div class = "leftmenu" & gt; // left menu stuff here, in the following format: & lt; Ul & gt; & Lt; Li class = "header" & gt; Content management list & lt; / Li & gt; & Lt; Li & gt; & Lt; One class = "primary" href = "/ administration / list.aspx? Subitem = category" & gt; Category & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A class = "primary" href = "/ administration / list.aspx? Sub-contract = archive" & gt; Collections & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Div & gt; & Lt; Div class = "content" & gt; & Lt; / Div & gt; & Lt; Div class = "temporary" & gt; & Lt; / Div & gt; & Lt; / Cover & gt; & Lt; / Body & gt; & Lt; / Html & gt;
I think you should catch Ajax response in your success handler function and It should be inserted where there is a need to go around for the first time in which many domed insertions for the same content
a) slow and cumbersome, and b) possibly where your problem is coming.
Most likely (do not see your code) you have got some duplicate IDs on an element.
If you need to include content returned to different locations in the document from the server, consider giving your server feedback on JSON and two HTML strings in different array elements.
UPDATE
From your example, it seems that you are only loading content in.main-col
, if you can Create a new server method that serves only one view with content within the main-column, and then do this:$ ("li"). Click (function () {var url = $ (This) .find ("a.primary"). Attr ("href"); if (url! = "" & Amp; url! = Null) {$ (" Main-col ") load (url);}});
Comments
Post a Comment