Pregunta

Estoy usando este ejemplo como base http: //simon.tpdserver2. co.uk/jquery/divgrowdemo.htm , estoy tratando de modificarlo para que en lugar del plugin de jQuery generando un html un href que permite al usuario cambiar el colapso expandir / (en este caso se trata de la forma de "+ ver más" y "-" Mostrar Menos enlaces), que puedo usar un enlace que está dentro de la propia div real. Así como un ejemplo, cada uno de los divs tiene "Michael Jordan", como la cabecera, me gustaría hacer que el tema se puede hacer clic que activa la expansión y colapso. ¿Cómo voy a ir haciendo eso?

¿Fue útil?

Solución

Firstly, please increase your acceptance rate. It is too low.

Secondly, you can check this link out: http://jsfiddle.net/sYwER/5/

I have coded it to be exactly the way you want. Post any follow up questions if you have any.

Hope this helps! Cheers :)

Otros consejos

The plugin used on that page adds the link item and click event handler to the divs marked with the 'more-block' class. You would have to modify the plugin. You would need to change it to 'linkify' the header text (i.e. find 'h2' elements in the appropriate divs, in that exmaple, and add a 'click' hander - to make it easier to style you might want to change the contents to a link or button element) and add click handlers for the new links you've added.

You are going to have to modify the code so that instead of inserting the new tags it adds them around the header. Because this is someone else script and it was not made for what you want to do. I would suggest just recreating the thing your self and scaling it down to the basics. First change the height to some fixed height and add the ... at the end. Then add an onclick event to the title that removes the fixed height and the ... Then after you have that find some tutorial on doing the sliding effect.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top