Jump to content
atblue

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

Recommended Posts

atblue

Hi. So, according to http://demo.pagelines.me/tools/ to add standard bootstrap style button easily to my site, I'd do the following:

[pl_button type="success" size="large" link="http://google.com" 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('http://exampletourli...om/example.html' '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

Share this post


Link to post
Share on other sites
Rob

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?


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
atblue

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:


<script>

function PopupCenter(pageURL, title,w,h) {

var left = (screen.width/2)-(w/2);

var top = (screen.height/4)-(h/4);

var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);

}

</script>

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

Share this post


Link to post
Share on other sites
Danny

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 - http://twitter.github.com/bootstrap/base-css.html#buttons


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Similar Content

    • IDdigital
      By IDdigital+
      Hi,
      A site of ours irregularly does not finish loading. The page in question is https://rw360.org/grievance-process/
      In Safari, I'll occasionally get the following error:
      [Error] TypeError: undefined is not an object (evaluating 'a.plModel.init')
          (anonymous function) (site.js:5:91)
          i (jquery.js:2:27455)
          add (jquery.js:2:27750)
          ready (jquery.js:2:29819)
          (anonymous function) (site.js:5)
          Global Code (site.js:5:3421)
      This seems to be a bug in PageLines as far as I can tell. Any suggestions or a fix coming?
      Thanks,
    • oseehys
      By oseehys+
      Of all the Items that is on Pagelines Shortcode, the Signup on the Settings page is the biggest miss, can anybody tell me how i can add the Signup Shortcode on a link my footer so that users can subscribe to my blog directly or better still to create the shortcode myself if thats possible, but instead of adding a new button somewhere down, i think its better to add the Signup shortcode to an existing link, Thanks
    • Michael Kummer
      By Michael Kummer+
      Hi guys!
      I am using a plugin called Speed Booster Pack to speed up the load time of michaelkummer.com. One of the plugin settings, Minimize HTML and JavaScript causes an error that I only get with Pagelines. With other themes, such as WordPress' Twenty Seventeen, I do not get that error.
      I have reproduced the problem on my staging site and if you look at the JavaScript console, you will see the following error:
      SyntaxError: Unexpected end of script
      Any clue what PageLines may be doing differently to be contributing to this issue? I contacted the plugin developer and they, of course, pointed me to the theme developer
      Thanks
      Michael
    • flourishdesignstudio
      By flourishdesignstudio+
      Hello,
      We are working on a site and the customers are complaining that the site loads too slowly. They contacted their host who mentioned that the Java Script is all loading at the beginning. Is it possible to delay the load of the less important Java Script until after the initial load to speed up the site? The goal is to load the page faster by minimizing the initial javascript calls.
      Are there any preferred plugins that you would recommend or does this end up causing excessive problems with plugins, etc.?
      Thanks for the help!
    • ppotent
      By ppotent+
      Any chance of a pagelines table plug-in coming? I know that the use of short codes and bootstrap can achieve this, but I can't seem to find any easy/visual editor way of doing this. There are table plug-ins around for wordpress, but honestly, they are pretty clunky. I'd pay for a tables plug-in, given how much I would use tables if I could.
       
       
×