Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum

Get help for TinyWebGallery, the best image gallery. The forum is also home for the Joomla JFUploader, TWG Flash Uploader and the Wordpress flash uploader.
It is currently 25. Jun 2018, 15:21

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 30. Jan 2018, 04:34 
Offline

Joined: 30. Jan 2018, 03:58
Posts: 1
I am working on a website for a shelter that uses petango to display an IFrame. My shortcode looks like this:

[advanced_iframe securitykey="xxxxxxxxxxxxxxxxxx" use_shortcode_attributes_only="true" src="http://ws.petango.com/webservices/adoptablesearch/wsLostFoundAnimals.aspx?LostFound=StrayOnly&species=All&gender=A&agegroup=All&colnum=3&orderby=ID&authkey="xxxxxxxxxxxxxxxxx" width="100%" height="600" id="advanced_iframe" enable_responsive_iframe="true" ]

I would like to be able to detect the size of the screen and set the number of columns to 1 or 3 - ie a mobile device with small screen. Mind you I am new to javascript and web programming in general, but I thought something like this in a custom html block would work:

Code:
<script type="text/javascript">
var cols = 0;
   if($(window).width() < 400)
   {
      cols = 1;
   }
   else
   {
      cols = 3;
   }
   
   return ([advanced_iframe securitykey="xxxxxxxxxxxxxxx" use_shortcode_attributes_only="true" src="http://ws.petango.com/webservices/adoptablesearch/wsLostFoundAnimals.aspx?LostFound=StrayOnly&species=All&gender=A&agegroup=All&colnum="+cols.toString()+"&orderby=ID&authkey=xxxxxxxxxxxxxxxxxxxxxxxxx" width="100%" height="600" id="advanced_iframe" enable_responsive_iframe="true" ]);
</script>


but it doesn't. Any idea how I would go about this in WordPress?


Top
 Profile  
 
PostPosted: 31. Jan 2018, 19:26 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 10839
This is not working because a shortcode is rendered on the server but Javascript on the client.
This does not work at all together.

You need to do this completely different! The plugin has an integrated browser detection in the pro version!
so you define 2 shortcodes - one for desktop and one for mobile.
check the integrated help for the browser detection.

Best, Michael


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
powered by phpbb | Datenschutz/ Privacy policy