Jump to content


Photo
- - - - -

bootstrap button shortcode - how to add javascript to the link=""?

bootstrap button javascript

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1 atblue

atblue

    Member

  • Members
  • 17 posts

Posted 19 October 2012 - 04:10 PM

Hi. So, according to

Please Login or Register to see this Hidden Content

to add standard bootstrap style button easily to my site, I'd do the following:

[pl_button type="success" size="large" link="

Please Login or Register to see this Hidden Content

target="blank"]Launch Tour[/pl_button]

That basic scenario works well enough, but what I'd really like this newly created button to do is something more complex. I'd like it to act just like this regular text link I've created:

<a onclick="PopupCenter('

Please Login or Register to see this Hidden Content

' 'tour',1300,830);" href="javascript:void(0);">temp launch tour link</a>

The question is how do I get the onclick info into the bootstrap button shortcode? Will the javascript:void(0) portion work as the replacement link="xxx"?

Thank you,
Chris

#2 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts

Posted 20 October 2012 - 02:21 AM

Chris,

I'm not convinced you can add javascript like that within a shortcode.

What's the purpose of this onclick action? What function does it perform?

#3 atblue

atblue

    Member

  • Members
  • 17 posts

Posted 03 November 2012 - 01:08 AM

Hi Rob, sorry for the late reply! I need to understand better how to follow these topics (got it now) .. as I thought I was receiving updates on replies, but evidently not.


To answer your question, the purpose of the onclick action is to call some javascript code that I've pasted into the Headerscripts Code that essentially says "open a new window at these sizes and at this location on the screen" so as to display our virtual tours from the portfolio (and portfolio detail) pages. The code I pasted is this:



Please Login or Register to see this Hidden Content


We have dozens of tours and some of them open at different sizes to be ideal, and so I wanted that control. Doing this from a text link is no problem, but of course the buttons look much better, so I was hoping to do it within the PL templates. Ultimately I will hand this off to my client, to edit and implement new/future tours, so I was hoping that there was a way I could teach him without having to dig into too much code.

Perhaps there is another way?

Many thanks again,
Chris

#4 Danny

Danny

    Is Awesome!

  • Moderators
  • 17533 posts

Posted 04 November 2012 - 11:23 AM

Hi,

You won't be able to add javascript to the button shortcode. However, you could try using the Bootstrap HTML code for the button and add your javascript that why instead.

Visit the buttons page on Bootstrap for the HTML code -

Please Login or Register to see this Hidden Content