javascript - Trying to modify a show/hide script so first div opens on page load (Django project) -


I'm working on a blog feed and there is a script which currently opens a Divel and it Divijh () Displays content on click; However, I have the first device in the feed when the page loads and I am still struggling to understand it. I am a serious Django and Javascript / jQuery Noobi, so any help offered with this is greatly appreciated.

The rest of the work currently loads the page feed, all the divisions are closed and when they are selected they are open.

base.html

  & lt; article id = "entry - {{object .pk}}" {% if continue_reading%} onclick = "toggleArticleActive ( 'entry - {{object.pk}}', true);" {% Endif%} & gt; ... blog post content & lt; / Article & gt;  

tools.js

  function Toglartiklaktiv (Lek_am_aidi, Aiaiaktiv) {if (Aktiv_aktiv) {// disable that activate all $ ( 'active' ). Each (function (index, value) {toggleArticleActive ($ (this) .attr ('id'), incorrect);}); } Var a = $ ('#' + article_dom_id); A.attr ("class", is_active? "Article-active": ""); If (is_active) {a.find ("Show-when-article-active"). Show (); // can animate, e.g. Show ('slow') a.find ("show-when-article-active"). Hide (); // Load the question about this entry in the main entry $ ('# div_activity'). Load ('/ f /? Entry =' + article_dom_id.replace ('Entry', '')); } Else {a.find ("Show-when-article-active"). Hide (); A.find ("show-when-article-no-active.") Show () .; }}  

You should only be able to display div only when ) The event has been removed.

  $ (document) .ready (function () {$ ("# firstdiv"). Show ();});  

Where is the ID of your first device in the "#firstdiv" list, you can also select the first div by using the ": first-hair" selector of your containing element:


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -