Could not open empty url with Javascript

Create Image Gallery with Responsive & Filterable jQuery Portfolio Gallery Plugin - Resilient Grid found HERE → http://www.jqueryscript.net/layout/Responsive-Filterable-jQuery-Portfolio-Gallery-Plugin-Elastic-Grid.html

Get this in a separate bundled js file ...

{
                    'title'         : 'WBIR.com Remake',
                    'description'   : 'Detailed Description Goes Here',
                    'thumbnail'     : ['images/small/39.jpg'],
                    'large'         : ['images/large/39.jpg'],
                    'button_list'   :
                    [
                        **{ 'title':'Live Preview', 'url' : 'http://dkdesigns.us/aiu/uploads/web/k_downey_ip5_vcdd330/index.html',},**
                    ],

                    'tags'          : ['Web']
                },

      

Can anyone point me in the right direction on how to make the Live Preview link open in a new window?

+3


source to share


3 answers


I know this is a bit out of date, but looking at the most recent source I can see that this feature is now supported (just as there was never an accepted answer).

You will need to write your code like this:

...
{
    'title'         : 'WBIR.com Remake',
    'description'   : 'Detailed Description Goes Here',
    'thumbnail'     : ['images/small/39.jpg'],
    'large'         : ['images/large/39.jpg'],
    'button_list'   :
    [
        { 
            'title': 'Live Preview', 
            'url': 'http://dkdesigns.us/aiu/uploads/web/k_downey_ip5_vcdd330/index.html', 
            'new_window': true, 
        },
    ],
    'tags': [ 'Web' ]
}
...

      



Notice the newly added property 'new_window':

in the first object of the button_list array.

I hope this helps those who look like me in the future find the answer faster and easier.

+1


source


This plugin you found does not support opening links in new windows .

However, editing the elastic_grid.js file that comes with the code as shown below will fix your problem.



if(urlList.length > 0){
   for (i = 0; i < urlList.length; i++){
      var ObjA = $('<a target="_blank"></a>');
      ObjA.addClass('link-button');
      if(i==0){
       ObjA.addClass('first');
      }
      ObjA.attr("href", urlList[i]['url']);
      ObjA.html( urlList[i]['title']);
      this.$detailButtonList.append(ObjA);
   }
}

      

0


source


So much. Got it working ...

In "elastic_grid.js" ... this is the code that did the trick ...

if(urlList.length > 0)
                {
                    for (i = 0; i < urlList.length; i++)
                    {
                        var ObjA = $('<a target="_blank"></a>');
                        ObjA.addClass('link-button');
                        if(i==0){
                            ObjA.addClass('first');
                        }
                        ObjA.attr("href", urlList[i]['url']);
                        ObjA.html( urlList[i]['title']);
                        /* ObjA.attr("target", "_blank"); */
                        this.$detailButtonList.append(ObjA);

                    }
                }

      

You are amazing! Thank you! Kevin

0


source







All Articles