javascript - Jquery don't focus in disqus div -


I use Disqus in my news site for comments, I display: none I I want to show the user a click on the button and hide this div.

I had created a script in jQuery to toggle this button, and I can hide the div by hiding, but when this show does not focus on Div, but this is the place Where button

This is not useful because pressing a button should take the user to the section where the comment is, but no.

script:

  $ (document) .ready (function () {$ ('. Gn-icon-bubble'). Attr ("href", "# Foot "). Click (function () {$ ('. Disqus_thread') toggle ('swing');});});   

.gn-icon-bubble is a button and as you know, .disqus-thread is div class; #foot My anchor is in the footer of the main page, but still does not work.

I tried to use anchors, but it gives it, still focus comments thank you for your help. To change the element dynamically preventDefault

Event Delegation Use to stop default work

  $ (document) .ready (function () {$ ('. Gn-icon-bubble'). Attr ("href" , "# Foot"); $ (document) .on ("click", ".gn-icon-bubble [href = # foot]", function (event) {// event.preventDefault (); if you use default anchor Action wants to stop the tag $ ('. Disqus_thread') toggle ('swing');});});    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -